What is the simplest way to have my Visual Studio 2015 solution also publish the ClickOnce app? Is it possible to change ClickOnce settings parameters, e.g. Update URL, when running the build?
Turns out this is easy:
/property:PublishDir="C:\\Users\TeamCity\\Desktop\\publish\\"
<=
where the ClickOnce artifacts get putI also had another Command Line Parameter /property:InstallUrl="http://my.domain/app/"
so I can set different install locations for different builds (test/production).
I then added a reference to this parameter in my *.csproj file:
<InstallUrl Condition="'$(InstallUrl)' == ''">http://default.domain/app/</InstallUrl>
<InstallUrl Condition="'$(InstallUrl)' != ''">$(InstallUrl)</InstallUrl>
You may also need these in *.csproj to get your ClickOnce app version sync'd with the TeamCity build number:
<ApplicationVersion Condition="'$(build_number)' == ''">1.0.0.2</ApplicationVersion>
<ApplicationVersion Condition="'$(build_number)' != ''">$(build_number)</ApplicationVersion>
<BuildNumber Condition="'$(build_number)' == ''">1.0.0.2</BuildNumber>
<BuildNumber Condition="'$(build_number)' != ''">$(build_number)</BuildNumber>
And set the build number format (Build Configuration > General Settings) to 1.0.0.%build.counter%
. Incrementing major/minor for your app manually.
What I then do is create 3 build steps with 3 different versions of the above for development, test and production. So I have the same build of the ClickOnce app that will install and auto-update from my development, test and production websites (I add all 3 builds to the code repository for the site).
I also add the "AssemblyInfo patcher" feature to the TeamCity build configuration and "system.Configuration" Parameter is set to "Release".
Dave's response above was very helpful (Thanks Dave!). Given this a TeamCity - ClickOnce specific question I figured I add some screenshots (TeamCity v2017.2)
7. Lastly make sure your Configuration WinForms project is set to build (this got me) otherwise TeamCity will not generate the ClickOnce Files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With