Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Adding explicit package references to fix CG alerts #91

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Merq.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@

<Version>0.0.0</Version>
</PropertyGroup>

<PropertyGroup>
<MicrosoftIORedistVersion>6.0.1</MicrosoftIORedistVersion>
<SystemTextJsonVersion>8.0.4</SystemTextJsonVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>false</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageReference Include="xunit.runner.msbuild" Version="2.7.0" />
<PackageReference Include="xunit.vsix" Version="0.9.3" />
<PackageReference Include="Microsoft.IO.Redist" Version="$(MicrosoftIORedistVersion)" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.10.39856" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
<PackageReference Include="Merq" Version="1.5.0" />
</ItemGroup>

Expand Down
340 changes: 171 additions & 169 deletions src/Vsix/Merq.Vsix/Merq.Vsix.csproj
Original file line number Diff line number Diff line change
@@ -1,169 +1,171 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Microsoft.Build.Artifacts" Version="2.0.16" />

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<RootNamespace>Merq</RootNamespace>
<TargetVsixContainerName>Merq.vsix</TargetVsixContainerName>
<IncludeGlobalAssemblyInfo>false</IncludeGlobalAssemblyInfo>

<CreateVsixContainer>true</CreateVsixContainer>
<DeployExtension Condition="'$(DeployExtension)' != ''">true</DeployExtension>
<IncludeCopyLocalReferencesInVSIXContainer>false</IncludeCopyLocalReferencesInVSIXContainer>

<!-- Allows properly importing VSSDK without using a legacy csproj -->
<CustomAfterMicrosoftCSharpTargets Condition="'$(VsSDKInstall)' != ''">$(VsSDKInstall)\Microsoft.VsSDK.targets</CustomAfterMicrosoftCSharpTargets>

<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
</PropertyGroup>

<Import Project="Merq.Vsix.props" />

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<Content Include="..\..\..\icon\200.png">
<Link>200.png</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\..\..\icon\Merq.ico">
<Link>Merq.ico</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\..\..\LICENSE">
<Link>LICENSE</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Merq" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Merq.Core" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Merq.VisualStudio" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="1.1.3" PrivateAssets="all" />
<PackageReference Include="Clarius.VisualStudio" Version="2.0.14" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.7.2189" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.7.37327" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.36" ExcludeAssets="all" />
</ItemGroup>

<ItemGroup>
<BindingRedirect Include="Merq" />
<BindingRedirect Include="Merq.Core" />
<BindingRedirect Include="Merq.VisualStudio" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<NuGetFilesToSign Include="$(PkgMerq)\lib\netstandard2.0\Merq.dll">
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
<NuGetFilesToSign Include="$(PkgMerq_Core)\lib\netstandard2.0\Merq.Core.dll" >
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
<NuGetFilesToSign Include="$(PkgMerq_VisualStudio)\lib\net472\Merq.VisualStudio.dll" >
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
</ItemGroup>

<!--
See https://github.com/xamarin/UITools/pull/705/commits/4a65bea18148f7ac2ecd34419450eda3550a776a by Thomas Sparks

TL;DR: ValidateVsixReferencedAssemblies locks the file, preventing Signing from succeeding
-->
<Target Name="TempRemoveVsixSourceItems" BeforeTargets="ValidateVsixReferencedAssemblies">
<ItemGroup>
<VSIXSourceItem Remove="$(IntermediateOutputPath)Merq.Vsix.dll"/>
</ItemGroup>
</Target>

<Target Name="ReturnVsixSourceItems" AfterTargets="ValidateVsixReferencedAssemblies">
<ItemGroup>
<VSIXSourceItem Include="$(IntermediateOutputPath)Merq.Vsix.dll"/>
</ItemGroup>
</Target>

<Target Name="GetFilesToSign" BeforeTargets="SignVsixContentFiles" DependsOnTargets="IncludeNuGetResolvedAssets" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<FilesToSign Include="$(IntermediateOutputPath)Merq.Vsix.dll">
<Authenticode>Microsoft400</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

<Target Name="SignVsix" BeforeTargets="SignFiles" DependsOnTargets="GetFilesToSign;CopyFilesToOutputDirectory;CreateVsixContainer" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<FilesToSign Include="$(OutDir)$(TargetVsixContainerName)">
<Authenticode>VsixSHA2</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

<Target Name="CopySignedVsixToPackageDir" AfterTargets="SignFiles" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<SignedFiles Include="$(OutDir)$(TargetVsixContainerName)" />
</ItemGroup>
<Copy SourceFiles="@(SignedFiles)" DestinationFolder="$(PackageOutputPath)" />
</Target>

<Target Name="IncludeNuGetResolvedAssets" DependsOnTargets="ResolvePackageAssets" BeforeTargets="GetVsixSourceItems;GetFilesToSign" Returns="@(MerqFile)">
<ItemGroup>
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq'))" />
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq.Core'))" />
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq.VisualStudio'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq.Core'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq.VisualStudio'))" />
<VSIXCopyLocalReferenceSourceItem Include="@(MerqFile)" />
</ItemGroup>
</Target>

<ItemGroup>
<EmbeddedResource Update="MerqPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
<DependentUpon>MerqPackage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<CustomToolNamespace>Merq.Properties</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>

<Import Project="Xamarin.VSSDK.BuildTools.GenerateBindingRedirects.targets" />
<Import Project="Merq.Vsix.targets" />

<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Microsoft.Build.Artifacts" Version="2.0.16" />

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<RootNamespace>Merq</RootNamespace>
<TargetVsixContainerName>Merq.vsix</TargetVsixContainerName>
<IncludeGlobalAssemblyInfo>false</IncludeGlobalAssemblyInfo>

<CreateVsixContainer>true</CreateVsixContainer>
<DeployExtension Condition="'$(DeployExtension)' != ''">true</DeployExtension>
<IncludeCopyLocalReferencesInVSIXContainer>false</IncludeCopyLocalReferencesInVSIXContainer>

<!-- Allows properly importing VSSDK without using a legacy csproj -->
<CustomAfterMicrosoftCSharpTargets Condition="'$(VsSDKInstall)' != ''">$(VsSDKInstall)\Microsoft.VsSDK.targets</CustomAfterMicrosoftCSharpTargets>

<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
</PropertyGroup>

<Import Project="Merq.Vsix.props" />

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<Content Include="..\..\..\icon\200.png">
<Link>200.png</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\..\..\icon\Merq.ico">
<Link>Merq.ico</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\..\..\LICENSE">
<Link>LICENSE</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Merq" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Merq.Core" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Merq.VisualStudio" Version="1.5.0" PrivateAssets="all" IncludeInVSIX="true" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.IO.Redist" Version="$(MicrosoftIORedistVersion)" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="1.1.3" PrivateAssets="all" />
<PackageReference Include="Clarius.VisualStudio" Version="2.0.14" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.7.2189" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.7.37327" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.36" ExcludeAssets="all" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
</ItemGroup>

<ItemGroup>
<BindingRedirect Include="Merq" />
<BindingRedirect Include="Merq.Core" />
<BindingRedirect Include="Merq.VisualStudio" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<NuGetFilesToSign Include="$(PkgMerq)\lib\netstandard2.0\Merq.dll">
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
<NuGetFilesToSign Include="$(PkgMerq_Core)\lib\netstandard2.0\Merq.Core.dll" >
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
<NuGetFilesToSign Include="$(PkgMerq_VisualStudio)\lib\net472\Merq.VisualStudio.dll" >
<Authenticode>3PartySHA2</Authenticode>
</NuGetFilesToSign>
</ItemGroup>

<!--
See https://github.com/xamarin/UITools/pull/705/commits/4a65bea18148f7ac2ecd34419450eda3550a776a by Thomas Sparks

TL;DR: ValidateVsixReferencedAssemblies locks the file, preventing Signing from succeeding
-->
<Target Name="TempRemoveVsixSourceItems" BeforeTargets="ValidateVsixReferencedAssemblies">
<ItemGroup>
<VSIXSourceItem Remove="$(IntermediateOutputPath)Merq.Vsix.dll"/>
</ItemGroup>
</Target>

<Target Name="ReturnVsixSourceItems" AfterTargets="ValidateVsixReferencedAssemblies">
<ItemGroup>
<VSIXSourceItem Include="$(IntermediateOutputPath)Merq.Vsix.dll"/>
</ItemGroup>
</Target>

<Target Name="GetFilesToSign" BeforeTargets="SignVsixContentFiles" DependsOnTargets="IncludeNuGetResolvedAssets" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<FilesToSign Include="$(IntermediateOutputPath)Merq.Vsix.dll">
<Authenticode>Microsoft400</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

<Target Name="SignVsix" BeforeTargets="SignFiles" DependsOnTargets="GetFilesToSign;CopyFilesToOutputDirectory;CreateVsixContainer" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<FilesToSign Include="$(OutDir)$(TargetVsixContainerName)">
<Authenticode>VsixSHA2</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

<Target Name="CopySignedVsixToPackageDir" AfterTargets="SignFiles" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<SignedFiles Include="$(OutDir)$(TargetVsixContainerName)" />
</ItemGroup>
<Copy SourceFiles="@(SignedFiles)" DestinationFolder="$(PackageOutputPath)" />
</Target>

<Target Name="IncludeNuGetResolvedAssets" DependsOnTargets="ResolvePackageAssets" BeforeTargets="GetVsixSourceItems;GetFilesToSign" Returns="@(MerqFile)">
<ItemGroup>
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq'))" />
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq.Core'))" />
<MerqPackageFile Include="@(RuntimeCopyLocalItems->WithMetadataValue('NuGetPackageId','Merq.VisualStudio'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq.Core'))" />
<MerqFile Include="@(MerqPackageFile->WithMetadataValue('Filename','Merq.VisualStudio'))" />
<VSIXCopyLocalReferenceSourceItem Include="@(MerqFile)" />
</ItemGroup>
</Target>

<ItemGroup>
<EmbeddedResource Update="MerqPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
<DependentUpon>MerqPackage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<CustomToolNamespace>Merq.Properties</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>

<Import Project="Xamarin.VSSDK.BuildTools.GenerateBindingRedirects.targets" />
<Import Project="Merq.Vsix.targets" />

<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>

</Project>