Use project references for analyzers

This commit is contained in:
Dustin Campbell 2023-09-19 12:12:01 -07:00
Родитель daeea8a9f1
Коммит d889dc01f7
9 изменённых файлов: 47 добавлений и 24 удалений

Просмотреть файл

@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34117.57
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Diagnostics.Analyzers", "Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj", "{42438A8F-6284-443A-A518-9AAD5371A403}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Diagnostics.Analyzers.Test", "Razor.Diagnostics.Analyzers.Test\Razor.Diagnostics.Analyzers.Test.csproj", "{C886DAB3-E7ED-4ED2-9D14-342762B30CA1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Diagnostics.Analyzers", "src\Analyzers\Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj", "{42438A8F-6284-443A-A518-9AAD5371A403}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +15,6 @@ Global
{42438A8F-6284-443A-A518-9AAD5371A403}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42438A8F-6284-443A-A518-9AAD5371A403}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42438A8F-6284-443A-A518-9AAD5371A403}.Release|Any CPU.Build.0 = Release|Any CPU
{C886DAB3-E7ED-4ED2-9D14-342762B30CA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C886DAB3-E7ED-4ED2-9D14-342762B30CA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C886DAB3-E7ED-4ED2-9D14-342762B30CA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C886DAB3-E7ED-4ED2-9D14-342762B30CA1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -2,6 +2,8 @@
"solution": {
"path": "Razor.sln",
"projects": [
"src\\Analyzers\\Razor.Diagnostics.Analyzers\\Razor.Diagnostics.Analyzers.csproj",
"src\\Analyzers\\Razor.Diagnostics.Analyzers.Test\\Razor.Diagnostics.Analyzers.Test.csproj",
"src\\Compiler\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\\src\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.csproj",
"src\\Compiler\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\\test\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test.csproj",
"src\\Compiler\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X\\src\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.csproj",

Просмотреть файл

@ -173,6 +173,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Utilities.Shared", "src\Shared\Microsoft.AspNetCore.Razor.Utilities.Shared\Microsoft.AspNetCore.Razor.Utilities.Shared.csproj", "{BAFE178B-7AD4-41AE-A75D-9B920B9EA050}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{4AA319E0-C81E-47CC-841A-6EFCB6784A1F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Diagnostics.Analyzers", "src\Analyzers\Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj", "{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Diagnostics.Analyzers.Test", "src\Analyzers\Razor.Diagnostics.Analyzers.Test\Razor.Diagnostics.Analyzers.Test.csproj", "{167F1426-D9AE-49DF-B214-F00536DBC305}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -717,6 +723,22 @@ Global
{BAFE178B-7AD4-41AE-A75D-9B920B9EA050}.Release|Any CPU.Build.0 = Release|Any CPU
{BAFE178B-7AD4-41AE-A75D-9B920B9EA050}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{BAFE178B-7AD4-41AE-A75D-9B920B9EA050}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.Release|Any CPU.Build.0 = Release|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.Debug|Any CPU.Build.0 = Debug|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.Release|Any CPU.ActiveCfg = Release|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.Release|Any CPU.Build.0 = Release|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{167F1426-D9AE-49DF-B214-F00536DBC305}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -796,6 +818,8 @@ Global
{4126E0A6-1CA9-44B1-AD22-66EDB9FEE7AD} = {92463391-81BE-462B-AC3C-78C6C760741F}
{7275F376-1B63-49D3-8078-0F7CA15CC637} = {3AE210D1-C435-4693-BF79-2EF13ED554B9}
{BAFE178B-7AD4-41AE-A75D-9B920B9EA050} = {3AE210D1-C435-4693-BF79-2EF13ED554B9}
{45B207E2-DDB3-44F0-87C5-DEFB5A9534A5} = {4AA319E0-C81E-47CC-841A-6EFCB6784A1F}
{167F1426-D9AE-49DF-B214-F00536DBC305} = {4AA319E0-C81E-47CC-841A-6EFCB6784A1F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0035341D-175A-4D05-95E6-F1C2785A1E26}

Просмотреть файл

@ -2,15 +2,13 @@
<Target Name="_PublishLanguageServerRids" AfterTargets="Pack" Condition="'$(DotNetBuildFromSource)' != 'true'">
<PropertyGroup>
<AnalyzersSolutionPath>$(MSBuildThisFileDirectory)..\src\Analyzers\Analyzers.sln</AnalyzersSolutionPath>
<BuildAnalyzersSolutionPath>$(MSBuildThisFileDirectory)..\BuildAnalyzers.sln</BuildAnalyzersSolutionPath>
<LanguageServerProject>$(MSBuildThisFileDirectory)..\src\Razor\src\rzls\rzls.csproj</LanguageServerProject>
<RazorSolutionPath>$(MSBuildThisFileDirectory)..\Razor.sln</RazorSolutionPath>
</PropertyGroup>
<MSBuild Projects="$(AnalyzersSolutionPath)"
<MSBuild Projects="$(BuildAnalyzersSolutionPath)"
Targets="Restore" />
<MSBuild Projects="$(AnalyzersSolutionPath)"
Targets="Build" />
<MSBuild Projects="$(RazorSolutionPath)"
Targets="Restore" />
<MSBuild Projects="$(LanguageServerProject)"

Просмотреть файл

@ -6,11 +6,12 @@
</PropertyGroup>
<ItemGroup>
<!-- Note: It is important Analyzer.sln builds first and does not allow building in parallel.
Projects in Razor.sln (or Razor.Slim.slnf) depend on Razor.Diagnostics.Analyzers.dll being
built, so it must be built first. If "BuildInParallel" is not set to "false", it will build
at the same time as Razor.sln and it'll be a race. -->
<ProjectToBuild Include="$(RepoRoot)src\Analyzers\Analyzers.sln" BuildInParallel="false" />
<!-- Note: It is important BuildAnalyzers.sln builds first and does not allow building in parallel.
Because projects in Razor.sln (or Razor.Slim.slnf) have a project reference to Razor.Diagnostics.Analyzers
that is treated as an analyzers, there can be file locking issues if Razor.Diagnostics.Analyzers isn't
built before Razor.sln. Setting "BuildInParallel" to "false" ensures that this solution will be fully
built first. -->
<ProjectToBuild Include="$(RepoRoot)BuildAnalyzers.sln" BuildInParallel="false" />
<ProjectToBuild Condition="'$(OS)'=='WINDOWS_NT' and '$(SdkTaskProjects)'==''" Include="$(MSBuildThisFileDirectory)..\Razor.sln" />

Просмотреть файл

@ -41,6 +41,9 @@
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="All" />
<PackageReference Include="Roslyn.Diagnostics.Analyzers" PrivateAssets="All" />
<Analyzer Include="$(ArtifactsBinDir)Razor.Diagnostics.Analyzers\$(Configuration)\netstandard2.0\Razor.Diagnostics.Analyzers.dll" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\Analyzers\Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
</ItemGroup>
</Project>

Просмотреть файл

@ -8,8 +8,10 @@
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="$(Tooling_MicrosoftCodeAnalysisBannedApiAnalyzersPackageVersion)" />
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="$(Tooling_RoslynDiagnosticsAnalyzersPackageVersion)" />
<Analyzer Condition="'$(IsApiShim)' != 'true'"
Include="$(ArtifactsBinDir)Razor.Diagnostics.Analyzers\$(Configuration)\netstandard2.0\Razor.Diagnostics.Analyzers.dll" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\Analyzers\Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
</ItemGroup>
</Project>

Просмотреть файл

@ -19,7 +19,10 @@
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="$(Tooling_MicrosoftCodeAnalysisBannedApiAnalyzersPackageVersion)" />
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="$(Tooling_RoslynDiagnosticsAnalyzersPackageVersion)" />
<Analyzer Include="$(ArtifactsBinDir)Razor.Diagnostics.Analyzers\$(Configuration)\netstandard2.0\Razor.Diagnostics.Analyzers.dll" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\Analyzers\Razor.Diagnostics.Analyzers\Razor.Diagnostics.Analyzers.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
</ItemGroup>
</Project>

Просмотреть файл

@ -6,10 +6,6 @@ using System.Runtime.CompilerServices;
// Razor shared utilities test assemblies
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Utilities.Shared.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
// Razor analyzers
[assembly: InternalsVisibleTo("Razor.Diagnostics.Analyzers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Razor.Diagnostics.Analyzers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
// Razor compiler assemblies
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Language, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]