Using Microsoft.Build component to load a csproj using method ProjectCollection.GlobalProjectCollection.LoadProject. Documentation here.
Loading a csproj with PackageReference and ExcludeAsset attribute in one of the references, example:
<PackageReference Include="SomePackage" ExcludeAssets="Compile">
<Version>1.0.0</Version>
</PackageReference>
The following exception is thrown:
The attribute "ExcludeAssets" in element is unrecognized.
Already tried different ToolVersions (2.0 | 4.0 |12.0), and both of the projects are compiled in .net472
How can I fix this?
Thanks