I am creating a NuGet package which contains a .Net Standard DLL and a config file. This project is supposed to support both .Net Core and .Net Framework.
In a few words, packing this DLL and config file using dotnet pack
and a .nuspec file, creates a package that is not "fully compatible" with .Net Core:
More details here:
In the project .csproj I am adding a .nuspec file reference:
<NuspecFile>.\MyProject.nuspec</NuspecFile>
Next to which I have the following .nuspec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MyProject</id>
<version>1.0.0</version>
<authors> </authors>
<description>some text</description>
</metadata>
<files>
<file src="MyProject.targets" target="Build\"/>
<file src="NLog.config" target="Build\" />
<file src="bin/Release/MyProject.dll" target="lib\dotnet"/>
</files>
<dependencies>
<dependency id="newtonsoft.json" version="11.0.2" />
<dependency id="nlog" version="4.5.10" />
</dependencies>
</package>
Then next to these two, I am having a .targets file:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="NLog.config">
<Link>NLog.config</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
I am packing this into a nuget package using dotnet pack
command within VSTS, giving it the path to my .csproj file.
I am trying to do this complicated approach because I want that NLog.config to be included automatically into the projects installing this package and also setting this config file property Copy to Output Directory to Copy always, approach which is taken from here and here, but which does not work yet.
As a side note, I say the same behavior before when I tried dotnet pack
and giving it the path to the .nuspec file, but it went away when I changed the path to the .csproj.
Has anyone any idea why this warning appears in the .Net Core clients using this package when packing it with .nuspec file?
Thank you so much for your patience and help!