Closed drewnoakes closed 3 years ago
I've created a new netcoreapp3.1 WinForms app and added a package reference to the latest version of the package.
netcoreapp3.1
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> <UseWindowsForms>true</UseWindowsForms> <Prefer32Bit>true</Prefer32Bit> </PropertyGroup> <ItemGroup> <PackageReference Include="unvell.D2DLib" Version="1.2.2" /> </ItemGroup> </Project>
NuGet restore completes succesfully. It doesn't appear to have added any managed assembly references to the compilation, as I see error:
error CS0246: The type or namespace name 'unvell' could not be found (are you missing a using directive or an assembly reference?)
Looking in the obj/project.assets.json file I see:
obj/project.assets.json
"unvell.D2DLib/1.2.2": { "type": "package", "build": { "build/unvell.D2DLib.targets": {} } },
The .targets file is picked up. I see the linked d2dlib32.dll in the project tree.
.targets
d2dlib32.dll
If I change <TargetFramework> to net4.8, the compilation error goes away. The assets file now shows:
<TargetFramework>
net4.8
"unvell.D2DLib/1.2.2": { "type": "package", "compile": { "lib/net20/d2dlibexport.dll": {}, "lib/net20/d2dwinform.dll": {} }, "runtime": { "lib/net20/d2dlibexport.dll": {}, "lib/net20/d2dwinform.dll": {} }, "build": { "build/unvell.D2DLib.targets": {} } },
For some reason, NuGet is excluding the compile and runtime items when targeting netcoreapp3.1 and net5.0-windows. My guess is the .nuspec file is at fault.
compile
runtime
net5.0-windows
.nuspec
I've created a new
netcoreapp3.1
WinForms app and added a package reference to the latest version of the package.NuGet restore completes succesfully. It doesn't appear to have added any managed assembly references to the compilation, as I see error:
Looking in the
obj/project.assets.json
file I see:The
.targets
file is picked up. I see the linkedd2dlib32.dll
in the project tree.If I change
<TargetFramework>
tonet4.8
, the compilation error goes away. The assets file now shows:For some reason, NuGet is excluding the
compile
andruntime
items when targetingnetcoreapp3.1
andnet5.0-windows
. My guess is the.nuspec
file is at fault.