Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add analyzer redirecting VSIX #42861

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 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
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<PackageVersion Include="Microsoft.TestPlatform.Build" Version="$(MicrosoftTestPlatformBuildPackageVersion)" />
<PackageVersion Include="Microsoft.TestPlatform.CLI" Version="$(MicrosoftTestPlatformCLIPackageVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.4.16" />
<PackageVersion Include="Microsoft.VisualStudio.Sdk" Version="17.2.32505.173" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.11.435" />
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="$(MicrosoftVisualStudioSetupConfigurationInteropVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.SolutionPersistence" Version="1.0.28" />
<PackageVersion Include="Microsoft.Web.Deployment" Version="$(WebDeploymentPackageVersion)" />
Expand Down
3 changes: 3 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
<add key="dotnet-tools-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json" />
<add key="dotnet-libraries" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
<add key="dotnet-libraries-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries-transport/nuget/v3/index.json" />
<add key="vssdk" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
<add key="vssdk-archived" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk-archived/nuget/v3/index.json" />
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
<!-- Used for Rich Navigation indexing task -->
<add key="richnav" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-buildservices/nuget/v3/index.json" />
<add key="general-testing" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this feed provide?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go away before merging. This PR depends on a roslyn API which is not merged yet (it's in PR dotnet/roslyn#74820). So I manually published the roslyn packages to the "general testing" feed to use them here.

</packageSources>
<disabledPackageSources>
<clear />
Expand Down
5 changes: 4 additions & 1 deletion eng/Signing.props
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
<FileSignInfo Include="MessagePack.Annotations.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="MessagePack.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="Nerdbank.Streams.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="StreamJsonRpc.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="CommandLine.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="FluentAssertions.dll" CertificateName="$(ExternalCertificateId)" />
Expand All @@ -81,6 +80,10 @@
<FileSignInfo Include="Valleysoft.DockerCredsProvider.dll" CertificateName="$(ExternalCertificateId)" />
</ItemGroup>

<ItemGroup>
<FileSignInfo Include="StreamJsonRpc.dll" CertificateName="MicrosoftSHA2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change about?

Copy link
Member Author

@jjonescz jjonescz Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting this signing error in official builds when building the VSIX:

D:\a_work\1\s.packages\microsoft.dotnet.arcade.sdk\10.0.0-beta.24430.1\tools\Sign.proj(72,5): error SIGN001: Signing Microsoft library 'D:\a_work\1\s\artifacts\tmp\Release\ContainerSigning\8296\AnalyzerRedirecting/StreamJsonRpc.dll' with 3rd party certificate '3PartySHA2'. The library is considered Microsoft library due to its copyright: '© Microsoft Corporation. All rights reserved.'.

FWIW, the same is specified in roslyn: https://github.com/dotnet/roslyn/blob/c737a04f3e9a895b5b5fff6d4c5467c17e9c49e8/eng/Signing.props#L62

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a new file you added? Why did your change cause it? @marcpopMSFT

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think StreamJsonRpc is some dependency brought in because we are building AnalyzerRedirecting as VSIX.

</ItemGroup>

<!-- Filter out any test packages from ItemsToSign -->
<ItemGroup>
<ItemsToSignPostBuild Remove="*tests*.nupkg" />
Expand Down
36 changes: 18 additions & 18 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,43 +97,43 @@
<Sha>63a09289745da5c256e7baf5f4194a750b1ec878</Sha>
<SourceBuild RepoName="fsharp" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.12.0-3.24459.1">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these version changes come through Arcade code flow?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't hurt to include dependency updates in your PR if your code depends on an external repo's changes that have not yet flowed to your current repo. It's ok as long as this file was modified using:

darc update-dependencies --channel <CHANNEL>

Ideally, a separate deps flow show come into the sdk repo with these same changes, and this PR can be rebased on top of it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as #42861 (comment), this will go away before merging - we will need to merge the roslyn part first, then let it flow into SDK, then we will be able to remove these version/nuget changes.

<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset.Framework" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.Net.Compilers.Toolset.Framework" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-3.25057.3">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.12.0-3.24459.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>911cf5f462960bdd01df1ea3c0d0c217b3c3838b</Sha>
<Sha>74f9a768bd10a7b9b0732bec47714ecd0f27e248</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.DeveloperCertificates.XPlat" Version="10.0.0-alpha.2.25061.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
Expand Down
17 changes: 9 additions & 8 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
compiler API targeted by analyzer assemblies. This is mostly an issue on source-build as
in that build mode analyzer assemblies always target the live compiler API. -->
<UsingToolMicrosoftNetCompilers Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</UsingToolMicrosoftNetCompilers>
<UsingToolVSSDK>true</UsingToolVSSDK>
<MicrosoftIORedistPackageVersion>6.0.1</MicrosoftIORedistPackageVersion>
<FlagNetStandard1XDependencies Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</FlagNetStandard1XDependencies>
<MicrosoftTestingPlatformVersion>1.6.0-preview.25059.14</MicrosoftTestingPlatformVersion>
Expand Down Expand Up @@ -209,14 +210,14 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/roslyn -->
<MicrosoftNetCompilersToolsetVersion>4.13.0-3.25057.3</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetFrameworkPackageVersion>4.13.0-3.25057.3</MicrosoftNetCompilersToolsetFrameworkPackageVersion>
<MicrosoftCodeAnalysisPackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-3.25057.3</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftNetCompilersToolsetVersion>4.12.0-3.24459.1</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetFrameworkPackageVersion>4.12.0-3.24459.1</MicrosoftNetCompilersToolsetFrameworkPackageVersion>
<MicrosoftCodeAnalysisPackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.12.0-3.24459.1</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/aspnet/AspNetCore -->
Expand Down
14 changes: 14 additions & 0 deletions sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.DotNet.HotReload.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.HotReload.Agent.Package", "src\BuiltInTools\HotReloadAgent\Microsoft.DotNet.HotReload.Agent.Package.csproj", "{2FF79F82-60C1-349A-4726-7783D5A6D5DF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Net.Sdk.AnalyzerRedirecting", "src\Microsoft.Net.Sdk.AnalyzerRedirecting\Microsoft.Net.Sdk.AnalyzerRedirecting.csproj", "{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Net.Sdk.AnalyzerRedirecting.Tests", "test\Microsoft.Net.Sdk.AnalyzerRedirecting.Tests\Microsoft.Net.Sdk.AnalyzerRedirecting.Tests.csproj", "{234BE46E-4AD6-485C-B0D3-E704EF504312}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -978,6 +982,14 @@ Global
{2FF79F82-60C1-349A-4726-7783D5A6D5DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FF79F82-60C1-349A-4726-7783D5A6D5DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FF79F82-60C1-349A-4726-7783D5A6D5DF}.Release|Any CPU.Build.0 = Release|Any CPU
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1}.Release|Any CPU.Build.0 = Release|Any CPU
{234BE46E-4AD6-485C-B0D3-E704EF504312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{234BE46E-4AD6-485C-B0D3-E704EF504312}.Debug|Any CPU.Build.0 = Debug|Any CPU
{234BE46E-4AD6-485C-B0D3-E704EF504312}.Release|Any CPU.ActiveCfg = Release|Any CPU
{234BE46E-4AD6-485C-B0D3-E704EF504312}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1158,6 +1170,8 @@ Global
{8D6A9984-118D-4415-A8FA-AB1F26CF5C44} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
{418B10BD-CA42-49F3-8F4A-D8CC90C8A17D} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
{2FF79F82-60C1-349A-4726-7783D5A6D5DF} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}
{234BE46E-4AD6-485C-B0D3-E704EF504312} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB8F26CE-4DE6-433F-B32A-79183020BBD6}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers</id>
<version>1.0.0</version>
<title>VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>https://www.microsoft.com/net/dotnet_library_license.htm</licenseUrl>
<projectUrl>https://github.com/dotnet/sdk</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Analyzers and generators from the runtime and SDK for VS insertion</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
</metadata>
<files>
<file src="$PAYLOAD_FILES$\**\*" />
</files>
</package>
1 change: 1 addition & 0 deletions src/Installer/redist-installer/redist-installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<Import Project="targets\GenerateBundledVersions.targets" />
<Import Project="targets\Crossgen.targets" />
<Import Project="targets\GenerateLayout.targets" />
<Import Project="targets\GenerateRuntimeAnalyzers.targets" />
<Import Project="targets\FileExtensions.targets" />
<Import Project="targets\GenerateArchives.targets" Condition="'$(PackInstaller)' != 'false'"/>
<Import Project="targets\GenerateMSIs.targets" />
Expand Down
28 changes: 27 additions & 1 deletion src/Installer/redist-installer/targets/GenerateMSIs.targets
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<SdkPlaceholderInstallerNuspecFile>$(SdkPkgSourcesRootDirectory)/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec</SdkPlaceholderInstallerNuspecFile>
<SdkPlaceholderInstallerNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.SdkPlaceholder.$(Architecture).$(FullNugetVersion).nupkg</SdkPlaceholderInstallerNupkgFile>

<SdkRuntimeAnalyzersNuspecFile>$(SdkPkgSourcesRootDirectory)/VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers.nuspec</SdkRuntimeAnalyzersNuspecFile>
<SdkRuntimeAnalyzersNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers.$(FullNugetVersion).nupkg</SdkRuntimeAnalyzersNupkgFile>
<SdkRuntimeAnalyzersSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers.swr</SdkRuntimeAnalyzersSwrFile>

<!-- Temp directory for light command layouts -->
<LightCommandObjDir>$(ArtifactsObjDir)/LightCommandPackages</LightCommandObjDir>
<!-- Directory for the zipped up light command package -->
Expand Down Expand Up @@ -414,6 +418,27 @@
</ItemGroup>
</Target>

<Target Name="GenerateRuntimeAnalyzersNupkg"
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs"
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "
Inputs="$(RuntimeAnalyzersLayoutDirectory)/**/*;
$(SdkRuntimeAnalyzersNuspecFile);
$(GenerateNupkgPowershellScript)"
Outputs="$(SdkRuntimeAnalyzersNupkgFile);$(SdkRuntimeAnalyzersSwrFile)">
<GenerateRuntimeAnalyzersSWR RuntimeAnalyzersLayoutDirectory="$(RuntimeAnalyzersLayoutDirectory)"
OutputFile="$(SdkRuntimeAnalyzersSwrFile)" />

<!-- Include the swr file in the nuget package for VS authoring -->
<Copy SourceFiles="$(SdkRuntimeAnalyzersSwrFile)" DestinationFolder="$(RuntimeAnalyzersLayoutDirectory)" />

<Exec Command="powershell -NoProfile -NoLogo $(GenerateNupkgPowershellScript) ^
'$(ArtifactsDir)' ^
'$(RuntimeAnalyzersLayoutDirectory.TrimEnd('\'))' ^
'$(FullNugetVersion)' ^
'$(SdkRuntimeAnalyzersNuspecFile)' ^
'$(SdkRuntimeAnalyzersNupkgFile)'" />
</Target>

<Target Name="GenerateMsis"
DependsOnTargets="GenerateLayout;
MsiTargetsSetupInputOutputs;
Expand All @@ -424,7 +449,8 @@
GenerateSdkPlaceholderMsi;
GenerateToolsetNupkg;
GenerateTemplatesNupkgs;
GenerateSdkPlaceholderNupkg"
GenerateSdkPlaceholderNupkg;
GenerateRuntimeAnalyzersNupkg"
Condition=" '$(OS)' == 'Windows_NT' and '$(Architecture)' != 'arm' " />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<PropertyGroup>
<RuntimeAnalyzersLayoutDirectory>$(ArtifactsBinDir)$(Configuration)\RuntimeAnalyzers</RuntimeAnalyzersLayoutDirectory>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions src/Layout/redist/redist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<Import Project="targets\GenerateArchive.targets" />
<Import Project="targets\OverlaySdkOnLKG.targets" Condition="'$(DotNetBuild)' != 'true'" />
<Import Project="targets\MSBuildExtensions.targets" />
<Import Project="targets\RuntimeAnalyzers.targets" />

<ItemGroup>
<PackageReference Include="NuGet.Build.Tasks" />
Expand Down
7 changes: 7 additions & 0 deletions src/Layout/redist/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@

</Target>

<Target Name="PublishRuntimeAnalyzers"
DependsOnTargets="GenerateRuntimeAnalyzers"
AfterTargets="OverlaySdkOnLKG">
<Copy SourceFiles="@(RuntimeAnalyzersContent)"
DestinationFiles="@(RuntimeAnalyzersContent->'$(ArtifactsBinDir)$(Configuration)\RuntimeAnalyzers\%(DeploymentSubpath)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<Target Name="PublishNetSdks"
BeforeTargets="Build">
<ItemGroup>
Expand Down
24 changes: 24 additions & 0 deletions src/Layout/redist/targets/RuntimeAnalyzers.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project>

<PropertyGroup>
<RuntimeAnalyzersSourceRoot>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</RuntimeAnalyzersSourceRoot>
<NetCoreRuntimeAnalyzersSubPath>packs\Microsoft.NetCore.App.Ref\*\analyzers</NetCoreRuntimeAnalyzersSubPath>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the SDK ever carry more than one pack? I guess if it did, we'd still be OK to include multiple versions since you match based on the major and minor.

How would this interact with VS on installation -- is it possible we'd ever have two of these analyzer packs installed, or would the newer one replace the old one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should work fine - the analyzers are deployed with the version number in their path like

C:\Program Files\Microsoft Visual Studio\2022\Preview\DotNetRuntimeAnalyzers\AspNetCoreAnalyzers\9.0.0-preview.7.24406.2\analyzers\dotnet\cs\Microsoft.AspNetCore.App.Analyzers.dll

so multiple of them could live side by side.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so if that happens would ever have more than one of these DotNetRuntimeAnalyzers installer packages inserted into VS that are trying to install the same files? I'm guessing no - if possible we should ensure that's the case.

<WindowsDesktopRuntimeAnalyzersSubPath>packs\Microsoft.WindowsDesktop.App.Ref\*\analyzers</WindowsDesktopRuntimeAnalyzersSubPath>
<AspNetCoreRuntimeAnalyzersSubPath>packs\Microsoft.AspNetCore.App.Ref\*\analyzers</AspNetCoreRuntimeAnalyzersSubPath>
<SDKAnalyzersSubPath>sdk\*\Sdks\Microsoft.NET.Sdk\analyzers</SDKAnalyzersSubPath>
<WebSDKAnalyzersSubPath>sdk\*\Sdks\Microsoft.NET.Sdk.Web\analyzers</WebSDKAnalyzersSubPath>
</PropertyGroup>

<Target Name="GenerateRuntimeAnalyzers" AfterTargets="OverlaySdkOnLKG">

<ItemGroup>
<RuntimeAnalyzersContent Include="$(ArtifactsBinDir)Microsoft.Net.Sdk.AnalyzerRedirecting\$(Configuration)\net472\**\*.*" DeploymentSubpath="AnalyzerRedirecting"/>
<RuntimeAnalyzersContent Include="$(RuntimeAnalyzersSourceRoot)$(NetCoreRuntimeAnalyzersSubPath)\**\*.*" DeploymentSubpath="NetCoreAnalyzers"/>
<RuntimeAnalyzersContent Include="$(RuntimeAnalyzersSourceRoot)$(WindowsDesktopRuntimeAnalyzersSubPath)\**\*.*" DeploymentSubpath="WindowsDesktopAnalyzers"/>
<RuntimeAnalyzersContent Include="$(RuntimeAnalyzersSourceRoot)$(AspNetCoreRuntimeAnalyzersSubPath)\**\*.*" DeploymentSubpath="AspNetCoreAnalyzers"/>
<RuntimeAnalyzersContent Include="$(RuntimeAnalyzersSourceRoot)$(SDKAnalyzersSubPath)\**\*.*" DeploymentSubpath="SDKAnalyzers"/>
<RuntimeAnalyzersContent Include="$(RuntimeAnalyzersSourceRoot)$(WebSDKAnalyzersSubPath)\**\*.*" DeploymentSubpath="WebSDKAnalyzers"/>
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Microsoft.VisualStudio.Shell;

namespace Microsoft.Net.Sdk.AnalyzerRedirecting;

[Guid("ef89a321-14da-4de4-8f71-9bf1feea15aa")]
public sealed class AnalyzerRedirectingPackage : AsyncPackage;
Loading