Reputation: 111
I have a large folder of click once deployed windows form projects (think hundreds) and I will have one day to update them all... So I am trying to programmatically update and publish them. Up to now it looks good I can update and build them, but I can't seem to find a way to actually publish.
My current method is trying to publish the projects via command line to effectively do the same thing that opening each one and clicking "publish now" would do in the IDE (Visual Studio 2012).
With devenv.exe I can get it to build but it doesn't look like there is a /publish option. I also looked into using msbuild.exe, with this I can publish but it doesn't go to the publish location I have in the IDE, it just puts the files in the debug or release folder.
msbuild.exe /t:Build /t:Publish /p:Configuration=Release
Msbuild has a "PublishProfile" option but I haven't had any luck getting that to work either, all the examples I see are for ASP projects so I'm not sure if it works for windows form projects.
If nothing else I could try to automate menu navigation and button clicks in Visual Studio with send keys, but I really don't like that solution, Any hints at how I can programmatically get the same affect as clicking the "publish now" button?
Upvotes: 2
Views: 2884
Reputation: 111
It looks like any property in the csproj file can be set via the /property: tag. So I then looked at setting the PublishUrl thinking it was the same as "Publish Location" (its not)... which lead me to the PublishDir property. That's the one I needed! so it looks like...
msbuild.exe myProject.sln /target:Publish /property:PublishDir=\\uncPath\publishdir\
Upvotes: 4