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
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>
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.