Ale*_*x C 5 nuget nuget-package nuspec
我有一个带有文件规范的nuget规范文件:
<files>
<file src="content\App_Start\*" target="content\App_Start" />
<file src="content\Views\*" target="content\Views" />
<file src="content\web.config.transform" target="content" />
<file src="readme.txt" target="" />
</files>
Run Code Online (Sandbox Code Playgroud)
这曾经是:
<files>
<file src="content\*" target="content" />
<file src="readme.txt" target="" />
</files>
Run Code Online (Sandbox Code Playgroud)
但这也有奇怪的行为(特别是App_Start没有被包括在内,虽然额外的内容文件夹仍在为视图添加...见下面的说明)
项目本身按照格式排列
\<root>
|_ readme.txt
|_ content
|_ Views
| |_ Home
| |_ <viewname>.cshtml
| |_ <viewname2>.cshtml
|_ App_Start
|_ <PreprocessFilename>.cs.pp
Run Code Online (Sandbox Code Playgroud)
然而,对我来说似乎奇怪的行为是NuGet包正在生成一个具有以下结构的zip文件:
\<root>
|_ readme.txt
|_ content
|_ content
| |_ Views
| |_ Home
| |_ <viewname>.cshtml
| |_ <viewname2>.cshtml
|_ App_Start
| |_ <PreprocessFilename>.cs.pp
|_ readme.txt
Run Code Online (Sandbox Code Playgroud)
所以关于nuget打包文件路径:
<file src="content\*" target="content" />指令使nuspec文件更"可维护"如果它是相关的,我使用.csproj文件来创建包.
我遇到了同样的问题,我能够解决它,但在我看来有点像黑客。我很想看到一个更好的解决方案,以便我的项目可以在最终包中拥有我想要的目录树,但我今天需要它才能工作,所以......
为了解决这个问题,我必须做的是将内容目录中的所有子目录拉出并放置在根级别,然后将目标设置为我希望它最终进入的子目录。
<file src="Scripts\" target="content\Scripts" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
974 次 |
| 最近记录: |