简体   繁体   English

NuGet包dll的+内容文件=失败?

[英]NuGet package dll's + content files = fail?

I created a nuget package. 我创建了一个nuget包。 I put some files and folders in a "content" folder and it worked great. 我把一些文件和文件夹放在“内容”文件夹中,效果很好。 So I added a bin folder with dll's and put this in my nuspec file : 所以我添加了一个带有dll的bin文件夹,并把它放在我的nuspec文件中:

  <files>
     src="bin\*.dll" target="lib" />
  </files>

dll's are nicely put in the reference, but the content isn't copied anymore. dll很好地放在引用中,但内容不再被复制了。

How can I manage to get them both working ? 我怎样才能让他们都工作?

@Edit @编辑

I know have this: 我知道有这个:

<file src="content\Controllers\*.*" target="Controllers" />
<file src="content\Views\Account\*.*" target = "Views\Account" />
<file src="bin\*.dll" target="lib" />

The package contains the right structure and files, but the files are not copied into my project. 该软件包包含正确的结构和文件,但文件不会复制到我的项目中。

The files are in a folder structure. 文件位于文件夹结构中。 When I put them directly into my content folder the are copied to the root of my project ... 当我将它们直接放入我的内容文件夹时,它被复制到我的项目的根...

When you define a files section in the nuspec we no longer do "automatic" / "Convention" based package creation. 当您在nuspec中定义文件部分时,我们不再执行基于“自动”/“约定”的包创建。 We see it as you are telling us what to include so we don't include things not in the list. 我们看到它正如您告诉我们要包含的内容所以我们不包括列表中没有的内容。 Simply add the content folder to that list and it will work. 只需将内容文件夹添加到该列表即可。

Edit to include comments from answerer's comment below 编辑以包含来自回答者评论的评论

The NuSpec file "files" section tell NuGet where to put the files in the package not in sln/proj when it its unpacked. NuSpec文件“files”部分告诉NuGet在解包时将文件放在包中的文件不在sln / proj中。 you want to write it like this: 你想这样写:

<file src="content\Controllers*.*" target="content\Controllers" /> 
<file src="content\Views\Account*.*" target = "content\Views\Account" /> 
<file src="bin*.dll" target="lib" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM