Skip to content

Commit 5f4914b

Browse files
MattKotsenasrjmurillo
authored andcommitted
Add AnalyzerUtilities to NuGet package (#326)
This fixes a regression caused by #290. `Microsoft.CodeAnalysis.AnalyzerUtilities` is not one of the assemblies provided by the host (i.e. compiler), so we need to include it in our own package. I'm not sure how to write an automated test for this. Our current tests don't use the NuGet package. Doing something like `dotnet format` in theory should work, but when I tried that it passed even without this change. This does result in a new package contents baseline, so we can chalk this one up to reviewer error and revisit if we find a better solution.
1 parent fc3aac2 commit 5f4914b

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/Analyzers/Moq.Analyzers.csproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<IncludeBuildOutput>false</IncludeBuildOutput><!-- Don't place the output assembly in the package's lib/ folder -->
88
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking><!-- Don't add the TargetFramework as a package dependency -->
99
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules><!-- Resolves RS1036 -->
10+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies><!-- Because we're a compiler plugin, we need to bundle any dependencies into our package -->
1011
</PropertyGroup>
1112

1213
<PropertyGroup Label="Package metadata">
@@ -39,6 +40,7 @@
3940
<None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="" />
4041
<None Include="$(OutputPath)\Moq.Analyzers.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
4142
<None Include="$(OutputPath)\Moq.CodeFixes.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
43+
<None Include="$(OutputPath)\Microsoft.CodeAnalysis.AnalyzerUtilities.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
4244
</ItemGroup>
4345

4446
<ItemGroup>

‎tests/Moq.Analyzers.Test/PackageTests.Baseline#contents.verified.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
|-- analyzers
55
| |-- dotnet
66
| | |-- cs
7+
| | | |-- Microsoft.CodeAnalysis.AnalyzerUtilities.dll
78
| | | |-- Moq.Analyzers.dll
89
| | | |-- Moq.CodeFixes.dll
910
|-- tools

0 commit comments

Comments
 (0)