-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersDocumentationQuestionResolution-AnsweredThe question has been answeredThe question has been answered
Milestone
Description
Version Used: 4.4.0
Steps to Reproduce:
Given:
foo.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
</Project>and foo.cs
namespace Library
{
public static class Foo
{
public static string Bar() => "Baz";
}
}Repro requires an analyzer that dumps the output of GetUsedAssemblyReferences. An example implementation is in https://github.com/dfederm/ReferenceTrimmer/pull/20/files, the failed test case (where the above repo is taken from) is dotnet test ReferenceTrimmer.sln --filter UnusedPackageReference
Expected Behavior:
The result of CSharpCompilation.GetUsedAssemblyReferences does not contain Newtonsoft.Json.dll reference
Actual Behavior:
The result of CSharpCompilation.GetUsedAssemblyReferences does contain <home>\.nuget\packages\newtonsoft.json\13.0.2\lib\net6.0\Newtonsoft.Json.dll
ericstj
Metadata
Metadata
Assignees
Labels
Area-CompilersDocumentationQuestionResolution-AnsweredThe question has been answeredThe question has been answered
Type
Projects
Status
Active/Investigating