msbuild - 将静态文件添加到在 webproject 发布事件上发布到 wwwroot 的 Nuget 包
问题描述
我正在尝试构建一个带有静态文件(js、CSS 和图像)的 NuGet 包,可以在 Web 项目中作为包引用。我希望在触发发布时将这些文件发布到发布目录。
我的 .nuspec 配置是
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>Test.Assets.Develop</id>
<version>1.0.0</version>
<authors>Bev</authors>
<owners>Bev</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Assets</description>
<copyright>Copyright 2017</copyright>
<contentFiles>
<files include="contentFiles\any\any\assets\**" buildAction="Content" copyToOutput="true" flatten="false" />
</contentFiles>
</metadata>
<files>
<file src="build\assets\**" target="contentFiles\any\any\assets"/>
</files>
</package>
我的静态文件被发布到<outputdir>/bin
文件夹而不是<outputdir>
.
解决方案
根据 MS 文档内容应复制到 nuget 包中的内容文件夹。
参考这里:https ://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package
内容文件可以放在内容文件夹 你可以使用这样的东西:
<files>
<file src="build\assets\**" target="content\" />
</files>
推荐阅读
- mysql - MySQL 算作一列
- c++ - 处理 DPI 和 ID2D1RenderTarget::DrawBitmap
- php - 使用 Foreach 循环提取 XML 数据,结果不一致
- c - 在这种情况下,局部变量会消耗内存吗?
- javascript - 如何使用承诺返回在nodejs的快速路由器中递归编辑的对象数组?
- javascript - 如何从 chrome 扩展中获取价值?
- linker - 链接器双重重定向 (IAR EWARM)
- r - 将函数应用于 df1,该函数基于扩展和操作 df1 每一行的数据创建一个新的 df
- sql-server - 如何记录用户访问 Windows 服务器上拒绝的路径
- vue.js - 为什么在 Vue Router 调度后不正确更新 store 数据?