MSBuild Does Not Create Publish Web Page (ClickOnce)

I had a problem: when publishing a ClickOnce application through MSBuild (4.0), publish.htm (or default.htm) is not created in the app.publish folder.

When publishing through Visual Studio, it gets a breakdown ...

In my .csproj file, I have the following properties set and it still doesn't work ...

<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <WebPage>default.htm</WebPage> 

Any ideas?

thanks

+6
source share
3 answers

I just solved this problem using the code available on this Mike Wade blog: http://blogs.msdn.com/b/mwade/archive/2009/02/28/how-to-generate-publish-htm-with -msbuild.aspx

Very useful!

Greetings.

-1
source

I am using Visual Studio 2015, but otherwise it seems like the same or similar issue. The solution was to open the Project File Properties in Visual Studio, go to the "Publish" settings and right-click [Options ...]. The Publish Settings dialog box appears. Select Deployment, and if you see that the Deployment Webpage is empty (mine was), enter publish.htm, then you can check “Automatically create a deployment webpage after each publication” (you need to check this ) Click [OK] to close the dialog box and then republish. The "publish.htm" file should now appear.

+2
source

I found a good solution here . You can use the template for publish.htm with {VERSION} . The MSBuild community tasks are required for the FileUpdate task.

BUILD_VERSION is the environment variable set by my build script. The PublishDir property is set in the msbuild argument.

  <!-- .... --> <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> 
+1
source

Source: https://habr.com/ru/post/954620/


All Articles