Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么nuget不添加我的文件?_Nuget_Nuget Package_Nuget Server_Nuget Spec - Fatal编程技术网

为什么nuget不添加我的文件?

为什么nuget不添加我的文件?,nuget,nuget-package,nuget-server,nuget-spec,Nuget,Nuget Package,Nuget Server,Nuget Spec,我有这个nuspec文件: <?xml version="1.0"?> <package > <metadata> <id>My.Package</id> <version>1.0.1.7</version> <title>My Package</title> <authors>My name</authors> <

我有这个nuspec文件:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>My.Package</id>
    <version>1.0.1.7</version>
    <title>My Package</title>
    <authors>My name</authors>
    <owners>Mu author</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>My description</description>
    <releaseNotes>Release note</releaseNotes>
    <copyright>Copyright 2017</copyright>
    <tags>tag1 tag2</tags>
    <contentFiles>
      <files include="myFile.config" copyToOutput="true" />
    </contentFiles>
  </metadata>
  <files>
    <file src="myFile.config" target=""/>
  </files> 
</package>
当我打包这个nuspec文件时,会创建我的nupkg文件,并且在NuGet Package Explorer中,我看到myFile.config包含在我的包中。到目前为止一切顺利

但是,当我安装这个包时,dll被添加到引用中,但是myFile.config没有添加到解决方案中

我尝试过但没有成功的事情: -查看磁盘上的文件夹,查看是否在其中创建了myFile.config - -

我还希望该文件将Copy设置为输出目录:Copy always

我错过了什么

PS:我正在一个私有nuget服务器上工作。

目标需要是内容,因为nugpkg的内容子目录的文件被复制到消费项目中

请注意,这仅适用于使用packages.config样式的引用NuGet软件包的项目。对于VS 2017中可用的PackageReference,.NET Core/ASP.NET Core/.NET标准项目的默认设置,有一个新的contentFiles功能,它在生成过程中逻辑地包含文件


有关更多信息,请参阅NuGet's。

谢谢,这很有效!我认为内容是消费项目的物理目录。您还知道为什么不将Copy to output目录设置为Copy always吗?因为这是不受支持的。我建议这样回答:应该对packages.config和PackageReference projectsAh都有效,太糟糕了。无论如何谢谢你!