MSBuild is not generating publish web page (ClickOnce)

前端 未结 2 1498
独厮守ぢ
独厮守ぢ 2020-12-19 00:45

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

相关标签:
2条回答
  • 2020-12-19 01:13

    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 - 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>
    
    0 讨论(0)
  • 2020-12-19 01:18

    I'm using Visual Studio 2015, but otherwise had what sounds like the same or similar issue. The solution was to open the Properties of the Project file in Visual Studio, go to the "Publish" settings, and on the right click [Options...]. This will open up the "Publish Options" dialog. Select "Deployment" and if you see the "Deployment web page" is empty (mine was) then enter "publish.htm", you should then be able to check "Automatically generate deployment web page after every publish" (you need to check this). Click [OK] to close the dialog and then republish. Your "publish.htm" file should now appear.

    0 讨论(0)
提交回复
热议问题