How to Set PublishUrl of ClickOnce Application From CommandLine

You could set any property you want from the command line but before doing so, you need to open your .csproj file in some texteditor(notepad etc). Find the property that you want to edit. In your case it is publish url. Remove this property from csproj file.

Then you could do this

msbuild /target:clean,publish /p:publishurl=c:\publish_location\

you must clean the project before you publish it.


Try to change your target to

msbuild /target:clean,rebuild,publish

because property you are overriding (PublishUrl) was not embedded into application file if only "Publish" target is used.