MSBuild is not generating publish web page (ClickOnce)(MSBuild 未生成发布网页 (ClickOnce))
问题描述
我遇到的问题是,当我通过 MSBuild (4.0) 发布 ClickOnce 应用程序时,publish.htm(或 default.htm)未在 app.publish 文件夹中创建.
I am facing a problem that when I publish my ClickOnce application through MSBuild (4.0), the publish.htm (or default.htm) isn't created in the app.publish folder.
当通过 Visual Studio 发布时,它会被装箱...
When publishing through Visual Studio, it gets crated...
在我的 .csproj 文件中,我设置了以下属性,但它仍然无法正常工作...
In my .csproj file I have the following properties set, and it still not working...
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>default.htm</WebPage>
有什么想法吗?
谢谢
推荐答案
我找到了一个很好的解决方案 这里.您可以使用带有 {VERSION} 占位符的 publish.htm 模板.MSBuild 社区任务 是 FileUpdate 任务所必需的.
I found a good solution here. You can use a template for publish.htm with {VERSION} placeholder inside. MSBuild Community Tasks are required for the FileUpdate task.
BUILD_VERSION - 环境变量,由我的构建脚本设置.PublishDir 属性在 msbuild 的参数中设置.
BUILD_VERSION - environment variable, set by my build script. PublishDir property is set in argument for msbuild.
<!-- .... -->
<Target Name="DoPublish">
<MSBuild Projects="$(ProjectFileName)" Targets="Publish" Properties="ApplicationVersion=$(BUILD_VERSION)" />
<!-- Write publish.htm file for ClickOnce -->
<Copy SourceFiles="$(ProjectDir)publish.htm" DestinationFiles="$(PublishDir)publish.htm"/>
<FileUpdate Files="$(PublishDir)publish.htm"
IgnoreCase="true"
Multiline="true"
Singleline="false"
Regex="{VERSION}"
ReplacementText="$(BUILD_VERSION)"/>
</Target>
</Project>
这篇关于MSBuild 未生成发布网页 (ClickOnce)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MSBuild 未生成发布网页 (ClickOnce)


基础教程推荐
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01