I'm using VS2019 trying to build a simple .NET Standard 2.0 class library that uses the Didstopia.PDFSharp .NET Standard 2.0 nuget package.
Here's a minimal reproduction starting with my .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Didstopia.PDFSharp" Version="1.0.0-beta8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
And here's my Class1.cs file:
using System;
using Didstopia.PDFSharp;
namespace ClassLibrary1
{
public class Class1
{
}
}
When I compile I get the following message:
Class1.cs(2,7,2,16): error CS0246: The type or namespace name 'Didstopia' could not be found (are you missing a using directive or an assembly reference?)
In Visual Studio in the code editing window for Class1 the "using Didstopia.PDFSharp" line has Didstopia underlined in red.
If instead of using a package reference I use a assembly reference to the Didstopia.PDFSharp.dll, from the packages folder, the class library compiles fine.
If I fork, clone and add a Project Reference to Didstopia.PDFSharp.dll everything compiles fine.
I've done "clean", delete bin & obj folders, removed the Didstopia package from the C:\Users\[myuserid]\.nuget\packages\didstopia.pdfsharp folder innumerable times.
I'm not sure what to even try next. Is there anyway to get more information out of the compiler about why it doesn't like the package reference?