-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add analyzer redirecting VSIX #42861
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
Changes from all commits
62154cf
cdb4892
2ed93ed
53a5074
5928f32
5165f0f
9807811
4e01a87
cdac6cc
7a31ffb
586ced5
c4a206a
e65c1c0
61af4e8
245b2f1
f5d671e
92e2284
f0b86a4
d5a3924
5da7cda
6a8f110
8680087
f73918a
74518c1
d8195ab
cf5c1f3
8b61147
7116b32
4c32363
bde0f8d
1971566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 --> | ||
|
@@ -405,6 +409,27 @@ | |
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="GenerateRuntimeAnalyzersNupkg" | ||
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs" | ||
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' And '$(DotNetBuild)' != 'true' " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jjonescz I just saw this PR. Why did you add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I will look into removing the condition. |
||
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" | ||
BeforeTargets="Pack" | ||
DependsOnTargets="GenerateLayout; | ||
|
@@ -416,6 +441,7 @@ | |
GenerateSdkPlaceholderMsi; | ||
GenerateToolsetNupkg; | ||
GenerateTemplatesNupkgs; | ||
GenerateSdkPlaceholderNupkg" /> | ||
GenerateSdkPlaceholderNupkg; | ||
GenerateRuntimeAnalyzersNupkg" /> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<RuntimeAnalyzersLayoutDirectory>$(ArtifactsBinDir)$(Configuration)\RuntimeAnalyzers</RuntimeAnalyzersLayoutDirectory> | ||
</PropertyGroup> | ||
|
||
</Project> |
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> | ||
jjonescz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<Project> | ||
|
||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net472</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsShipping>false</IsShipping> | ||
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild> | ||
|
||
<!-- VSIX --> | ||
<!-- We duplicate some logic like VsixVersion from arcade targets because they are imported only when using .NET Framework MSBuild, | ||
but we want to build the VSIX in SDK's CI which is using Core MSBuild. See https://github.com/dotnet/arcade/issues/15617. --> | ||
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix> | ||
marcpopMSFT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<GeneratePkgDefFile>true</GeneratePkgDefFile> | ||
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer> | ||
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer> | ||
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment> | ||
<IncludeCopyLocalReferencesInVSIXContainer>false</IncludeCopyLocalReferencesInVSIXContainer> | ||
<VsixVersion Condition="'$(VsixVersion)' == ''">42.42.42.4242424</VsixVersion> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when is this ever set to a different value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, good point, I thought arcade would set this, but maybe something is missing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does look like the arcade targets set this. src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.targets. I think it does set this to a default version if not specified. So maybe this line is not necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, okay, I've remembered why this is needed. (I will add a comment.) Arcade imports VisualStudio.targets only on .NET Framework MSBuild. But SDK's CI builds are using Core MSBuild. Filed also dotnet/arcade#15617.
And yes, it's set to a different value in production builds, see the target |
||
<DeployExtension Condition="'$(MSBuildRuntimeType)' == 'Core'">false</DeployExtension> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Sdk" /> | ||
<PackageReference Include="Microsoft.VSSDK.BuildTools" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<InternalsVisibleTo Include="Microsoft.Net.Sdk.AnalyzerRedirecting.Tests" /> | ||
</ItemGroup> | ||
|
||
<Target Name="GetVsixVersion" Returns="$(VsixVersion)"> | ||
<PropertyGroup> | ||
<VsixVersion Condition="'$(VersionSuffixDateStamp)' != ''">$(VersionPrefix).$(VersionSuffixDateStamp)$(VersionSuffixBuildOfTheDayPadded)</VsixVersion> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<!-- Order matters here. VSSDK appends to PrepareForRunDependsOn but Microsoft.NET.Sdk overwrites it. See https://github.com/dotnet/msbuild/issues/2393. --> | ||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | ||
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets') and '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64'" /> | ||
|
||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know how often these get updated and how best to keep them updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets a non-preview release with every VS minor version. But I don't think this needs to be updated unless a new functionality from the VS SDK is needed (or if there are some transitive dependency conflicts). That's why it's fine that this is using an old version 17.2 instead of the latest 17.13 (but the real reason I chose 17.2 was because there were some conflicts with transitive dependencies IIRC).