[英]VSTS Build Definition - add additional files to build output
使用RMO,我创建了一个Visual Studio构建定义。 在“复制文件”步骤中,如果我将内容设置为
**\*.zip
它会创建我的已编译项目的zip文件以及web.config文件。 我需要向此zip文件中添加一些其他配置文件,这些文件是解决方案级别文件夹,而不是项目文件夹中。 在预构建事件中,这3个文件将复制到项目文件夹中。 因此,我无法为这些文件设置Build Action = Content。
您可以在项目文件中添加以下代码,以在构建过程中在zip文件中包含其他文件:
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="PathToExtraFile" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
有关详细信息,请参考此链接: 使用Visual Studio的ASP.NET Web部署:部署额外的文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.