I have a web project (mvc5) with a project.json inside.
Also, I have a nuget package. Inside this package (besides the dll reference) I have some Content files (cshtml files, css, javascript etc).
There are 2 goals to achieve:
- After installing the package to the project I want to get Content Files included to the project.
- After Building the project I want nuget to restore the content files
The nuspec file:
<?xml version="1.0"?><package><metadata> /.../<dependencies><group targetFramework="net461"> /.../</group></dependencies><contentFiles><files include="**/*.*" flatten="false" copyToOutput="false" buildAction="Content" /> </contentFiles></metadata><files> /.../<file src="..\src\Content\**\*.*" target="contentFiles\any\any\Content" /> <file src="..\src\Views\**\*.*" target="contentFiles\any\any\Views" /> </files></package>
Well, Visual Studio is adding nuget package with no issues. The reference is also included. But the content is always missing. The content files are not copied from the /packages/ folder and are not included to the project.The same is when I build the project - it just copies the dll and does not touch content files from the package at all.
It only works if I have copyToOutput="true", but all content goes to bin folder, of course.
The reason why I need to restore the content files is that the files from the nuget package are ignored by a tfs 'ignore file' (.tfignore). I don't want to have these content files to be a part of the web project in TFS. However, of course, TFS build server fails to build the project, because some content files are missing (the files from the package). So I want nuget on the build server to restore the content files before it stats building the project.
Any idea how to get this work if it is possible? Or maybe this is not possible and I must have content files to be included to the project?