NuGet 包 dll 的内容文件=失败?
我创建了一个 nuget 包。我将一些文件和文件夹放在“内容”文件夹中,效果很好。因此,我添加了一个包含 dll 的 bin 文件夹,并将其放入我的 nuspec 文件中:
<files>
src="bin\*.dll" target="lib" />
</files>
DLL 很好地放入了引用中,但不再复制内容。
我怎样才能让它们都工作?
@编辑
我知道有这个:
<file src="content\Controllers\*.*" target="Controllers" />
<file src="content\Views\Account\*.*" target = "Views\Account" />
<file src="bin\*.dll" target="lib" />
该包包含正确的结构和文件,但这些文件没有复制到我的项目中。
这些文件位于文件夹结构中。当我将它们直接放入我的内容文件夹时,它们会被复制到我的项目的根目录......
I created a nuget package. 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 :
<files>
src="bin\*.dll" target="lib" />
</files>
dll's are nicely put in the reference, but the content isn't copied anymore.
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 ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您在 nuspec 中定义文件部分时,我们不再进行基于“自动”/“约定”的包创建。我们将其视为您告诉我们要包含的内容,因此我们不会包含列表中未包含的内容。只需将内容文件夹添加到该列表中即可。
编辑以包含下面回答者评论中的评论
NuSpec 文件“文件”部分告诉 NuGet 在解包时将文件放在包中的位置而不是 sln/proj 中。你想这样写:
When you define a files section in the nuspec we no longer do "automatic" / "Convention" based package creation. 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. you want to write it like this: