I'm using this .nuspec file to generate a nuget package.
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>ClassLibrary1</id>
<version>1.0.0</version>
<title>Title</title>
<authors>Author</authors>
<owners>Owner</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright 2017</copyright>
<contentFiles>
<files include="any/any/myfile.xml" buildAction="None" copyToOutput="true" flatten="true" />
</contentFiles>
</metadata>
</package>
Using this configuration when building a project that references this nuget package the content files will be copied to the output folder. Now I'm converting my project into .Net core project and i want to use the project.json to generate the nuget package and get rid of the .nuspec file. This is my project.json
{
"version": "1.0.0-*",
"dependencies": { },
"frameworks": {
"net452": {
}
},
"packOptions": {
"files": {
"mappings": {
"contentFiles/any/any/myfile.xml": "Configuration/myfile.xml"
}
}
},
"scripts": {
"postcompile": [
"dotnet pack --no-build --configuration %compile:Configuration%"
]
}
}
Now the problem is that when building a project that references this nuget package it will try to compile the content file too. And the build fails. How can I exclude the contentFile from compilation?