I am making a NuGet package which targets .Net Standard 1.3 and .Net Fx 4.5.
To do this, I have a solution with my NetStandard version of the code, which is highly tested, and I copy across the two *.cs files to a duplicate project which targets Fx 4.5 - I didn't know a better way to do it. This is my first time targeting multiple frameworks.
I then have a nuspec
file which looks like this (metadata has been snipped for brevity):
<?xml version="1.0"?>
<package>
<metadata>
<snip/>
</metadata>
<files>
<file src="VillageSoftware.PathMatcher-NetFx45\bin\Release\VillageSoftware.PathMatcher-NetFx45.dll" target="lib\net45\VillageSoftware.PathMatcher.dll" />
<file src="VillageSoftware.PathMatcher\bin\Release\netstandard1.3\VillageSoftware.PathMatcher.dll" target="lib\netstandard1.3\VillageSoftware.PathMatcher.dll" />
</files>
</package>
I can successfully pack this with nuget pack VillageSoftware.PathMatcher.nuspec
I was initially testing the package using a local (C:\
) package source but have since pushed the package to NuGet.org
To test, I created a new .Net Framework 4.5 Console App, and when I install my package using either Install-Package
or the 'Manage NuGet Packages' window, the reference shows up with an exclamation on it:
Double clicking the reference throws up an error message box:
This project cannot be viewed in the object browser because it is unavailable or not yet built. Please ensure that the project is available and built.
Contrastingly, if I use 'Add Reference' to add the VillageSoftware.PathMatcher DLL directly to the TestBed project, it works fine.
My theory is that the frameworks between the package and the host project are not matching up, but I don't know why! The package packs up fine, and the successful Install-Package shows that NuGet is using the correct lib, not the NetStandard version. I don't think my lib has any dependencies which I've missed in the nuspec.
Why is this happening?