MSBuild doesn't respect PublishUrl property for my ClickOnce app

TheBlueSky picture TheBlueSky · Dec 17, 2009 · Viewed 21.3k times · Source

I'm trying to make a batch file to publish the few ClickOnce application we have in one click. I'm using msbuild for that, and as an example the below command line shows how I'm doing it:

msbuild
    MyApp.sln
    /t:Publish
    /p:Configuration=Release
    /p:PublishUrl="C:\Apps\"
    /v:normal > Log.txt

(wrapped for easier reading)

when I run the above command it builds and publish the application in the release directory, i.e. bin\release! Any idea why msbuild doesn't respect PublishUrl property in my example above?

PS: I tried also different combinations including remove 'Configuration', use 'Rebuild' and 'PublishOnly' as targets, and remove the the quotation marks but without any success.

Answer

wallismark picture wallismark · Feb 1, 2010

You are setting the wrong property. Try PublishDir instead.

You can pass it into msBuild as you are or you can set it in the project file (or maybe the sln file too, not sure I always use the project file.) like this

      <PropertyGroup>
    <PublishDir>C:\Dev\Release\$(BuildEnvironment)\</PublishDir>
  </PropertyGroup>

I've just done a few blog posts on MsBuild and ClickOnce stuff, check it out you 'should' find them useful...

Good luck :-)