Skip to content

Commit

Permalink
Split analyzer assemblies to avoid Workspaces reference
Browse files Browse the repository at this point in the history
The compiler does not provide the workspaces layer during command line
builds. Removing the reference to the workspaces layer from the analyzer
assembly ensures that the analyzers will never silently fail to load due
to an accidental reference to the workspaces layer.
  • Loading branch information
sharwell committed Aug 13, 2019
1 parent c4e0ddf commit 5ae187e
Show file tree
Hide file tree
Showing 55 changed files with 60 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/xunit.analyzers.fixes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyCompany(".NET Foundation")]
[assembly: AssemblyProduct("xUnit.net Testing Framework")]
[assembly: AssemblyCopyright("Copyright (C) .NET Foundation")]
[assembly: AssemblyTitle("xUnit.net Code Analyzers")]
[assembly: AssemblyVersion("99.99.99.0")]
[assembly: AssemblyFileVersion("99.99.99.0")]
[assembly: AssemblyInformationalVersion("99.99.99-dev")]
[assembly: InternalsVisibleTo("Xunit.Analyzers.DocBuilder, PublicKey=0024000004800000940000000602000000240000525341310004000001000100252E049ADDEA87F30F99D6ED8EBC189BC05B8C9168765DF08F86E0214471DC89844F1F4B9C4A26894D029465848771BC758FED20371280EDA223A9F64AE05F48B320E4F0E20C4282DD701E985711BC33B5B9E6AB3FAFAB6CB78E220EE2B8E1550573E03F8AD665C051C63FBC5359D495D4B1C61024EF76ED9C1EBB471FED59C9")]
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions src/xunit.analyzers.fixes/xunit.analyzers.fixes.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
<RootNamespace>Xunit.Analyzers</RootNamespace>
<TargetFramework>netstandard1.1</TargetFramework>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.2.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="1.2.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\xunit.analyzers\xunit.analyzers.csproj" />
</ItemGroup>

</Project>
5 changes: 3 additions & 2 deletions src/xunit.analyzers.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<tags>xunit.analyzers, analyzers, roslyn, xunit, xunit.net</tags>
</metadata>
<files>
<file src="xunit.analyzers\bin\$Configuration$\netstandard1.1\xunit.analyzers.dll" target="analyzers\dotnet\cs\" />
<file src="xunit.analyzers\tools\*.ps1" target="tools\" />
<file src="xunit.analyzers.fixes\bin\$Configuration$\netstandard1.1\xunit.analyzers.dll" target="analyzers\dotnet\cs\" />
<file src="xunit.analyzers.fixes\bin\$Configuration$\netstandard1.1\xunit.analyzers.fixes.dll" target="analyzers\dotnet\cs\" />
<file src="xunit.analyzers.fixes\tools\*.ps1" target="tools\" />
</files>
</package>
2 changes: 2 additions & 0 deletions src/xunit.analyzers.vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="xunit.analyzers" Path="|xunit.analyzers|"/>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="xunit.analyzers.fixes" Path="|xunit.analyzers.fixes|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="xunit.analyzers" Path="|xunit.analyzers|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="xunit.analyzers.fixes" Path="|xunit.analyzers.fixes|"/>
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio core editor" />
Expand Down
4 changes: 4 additions & 0 deletions src/xunit.analyzers.vsix/xunit.analyzers.vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<Project>{F513916A-00AD-499A-9B76-E52D9FBFCED5}</Project>
<Name>xunit.analyzers</Name>
</ProjectReference>
<ProjectReference Include="..\xunit.analyzers.fixes\xunit.analyzers.fixes.csproj">
<Project>{F563B984-0E18-4479-A42C-DF2BA970A4C2}</Project>
<Name>xunit.analyzers.fixes</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
Expand Down
1 change: 1 addition & 0 deletions src/xunit.analyzers/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
[assembly: AssemblyFileVersion("99.99.99.0")]
[assembly: AssemblyInformationalVersion("99.99.99-dev")]
[assembly: InternalsVisibleTo("Xunit.Analyzers.DocBuilder, PublicKey=0024000004800000940000000602000000240000525341310004000001000100252E049ADDEA87F30F99D6ED8EBC189BC05B8C9168765DF08F86E0214471DC89844F1F4B9C4A26894D029465848771BC758FED20371280EDA223A9F64AE05F48B320E4F0E20C4282DD701E985711BC33B5B9E6AB3FAFAB6CB78E220EE2B8E1550573E03F8AD665C051C63FBC5359D495D4B1C61024EF76ED9C1EBB471FED59C9")]
[assembly: InternalsVisibleTo("xunit.analyzers.fixes, PublicKey=0024000004800000940000000602000000240000525341310004000001000100252e049addea87f30f99d6ed8ebc189bc05b8c9168765df08f86e0214471dc89844f1f4b9c4a26894d029465848771bc758fed20371280eda223a9f64ae05f48b320e4f0e20c4282dd701e985711bc33b5b9e6ab3fafab6cb78e220ee2b8e1550573e03f8ad665c051c63fbc5359d495d4b1c61024ef76ed9c1ebb471fed59c9")]
7 changes: 1 addition & 6 deletions src/xunit.analyzers/xunit.analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.2.0-beta2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="1.2.2" />
</ItemGroup>

<ItemGroup>
<Analyzer Include="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\1.2.0-beta2\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\1.2.0-beta2\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="1.2.2" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions test/xunit.analyzers.tests/xunit.analyzers.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\xunit.analyzers\xunit.analyzers.csproj" />
<ProjectReference Include="..\..\src\xunit.analyzers.fixes\xunit.analyzers.fixes.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion tools/DocBuilder/DocBuilder.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -13,6 +13,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\xunit.analyzers\xunit.analyzers.csproj" />
<ProjectReference Include="..\..\src\xunit.analyzers.fixes\xunit.analyzers.fixes.csproj" />
<None Include="..\..\docs\**\*.*" LinkBase="docs" />
</ItemGroup>

Expand Down
10 changes: 8 additions & 2 deletions xunit.analyzers.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.29006.145
MinimumVisualStudioVersion = 15.0.26228.4
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xunit.analyzers", "src\xunit.analyzers\xunit.analyzers.csproj", "{F513916A-00AD-499A-9B76-E52D9FBFCED5}"
EndProject
Expand All @@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{C3B12BC2
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocBuilder", "tools\DocBuilder\DocBuilder.csproj", "{FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xunit.analyzers.fixes", "src\xunit.analyzers.fixes\xunit.analyzers.fixes.csproj", "{F563B984-0E18-4479-A42C-DF2BA970A4C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD9C12EA-2A4B-49A8-AC8B-4AFFE1C1E9F4}.Release|Any CPU.Build.0 = Release|Any CPU
{F563B984-0E18-4479-A42C-DF2BA970A4C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F563B984-0E18-4479-A42C-DF2BA970A4C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F563B984-0E18-4479-A42C-DF2BA970A4C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F563B984-0E18-4479-A42C-DF2BA970A4C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 5ae187e

Please sign in to comment.