MSBuild 未生成发布网页 (ClickOnce)

MSBuild is not generating publish web page (ClickOnce)(MSBuild 未生成发布网页 (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 cannot find a reference(MSBuild 找不到参考)
The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
quot;File has a different computed hash than specified in manifestquot; error when signing the EXE(“文件的计算哈希值与清单中指定的不同签署EXE时出错)
Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI?(良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 MSBuild 脚本?)
Run an MSBuild target only if project is actually built(仅在实际构建项目时运行 MSBuild 目标)
MS-Build BeforeBuild not firing(MS-Build BeforeBuild 未触发)