nuspec contentFiles not added to a project

后端 未结 2 550
长发绾君心
长发绾君心 2021-01-25 04:41

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 Conten

相关标签:
2条回答
  • 2021-01-25 05:40

    you could add a msbuild target to your package. in this target you can execute the nuget restore command...

    example:

    <?xml version="1.0"?>
    <package >
        <metadata>
        <!-- ... -->
        </metadata>
        <files>
          <!-- Include your MSBuild target to \build -->
          <file src="build\myNuGetRestoreTarget.targets" target="build" />
        </files>
    </package>
    

    see: https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package

    0 讨论(0)
  • 2021-01-25 05:41

    This is by design. NuGet packages are no longer supposed to modify the project's source but only add to its built output or build process (in addition to .NET libraries). The content folder for adding sources to the project is only continued to be supported for packages.config based projects since it would be a breaking change for existing projects, but projects using project.json or PackageReference (VS 2017) get the new behaviour.

    0 讨论(0)
提交回复
热议问题