Thursday, April 28, 2005 3:44 PMYou can build the Publish target of a .csproj with the command-line MSBuild.exe, but when the Visual Studio IDE publishes a project it also copies it to a designated location and in Beta 2 appears to do something clever with preserving old .application manifests.
Is there a way to have MSBuild.exe perform these extra steps from the command line? Perhaps I'm building the wrong target?
Friday, April 29, 2005 9:06 PMModeratorGraeme,
MSBuild won't actually perfom the publish (i.e. the physical transfer of files etc) when building from the command-line - as you've discovered. The simple reason is that the functionality to do that is in the IDE itself.
MSBuild will only perform the build related tasks.
Tuesday, January 10, 2006 4:43 PMWhen you run "msbuild /t:publish" is it possible to have it create the publish.htm page and also iterate the version # of the folder?
- Proposed As Answer by IMx Thursday, December 24, 2009 5:47 PM
Friday, January 13, 2006 7:58 PMFYI, This was the solution to my problem...
<Project DefaultTargets="DoPublish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<MSBuild Projects="AlgoCollateral.v5.sln" Targets="Clean;Build" Properties="ApplicationVersion=$(Version)"/>
<MSBuild Projects="AlgoCollateral/AlgoCollateral.csproj" Targets="Publish" Properties="ApplicationVersion=$(Version)" />
<!-- Write publish.htm file for ClickOnce -->
<Copy SourceFiles=".\Build\publish.htm" DestinationFiles="$(ClickOnceInstallDirectory)\publish.htm"/>
<Copy SourceFiles="AlgoCollateral\bin\$(Configuration)\AlgoCollateral.application" DestinationFiles="$(ClickOnceInstallDirectory)\AlgoCollateral.application"/>
<!-- Move Click Once Files -->
- Proposed As Answer by IMx Thursday, December 24, 2009 5:47 PM
Friday, March 03, 2006 2:33 PMCan you tell me how you're keeping track/incrementing the ApplicationVersion number? It appears you are simply passing it in through the CCNetLabel property. That's my biggest challenge right now with trying to build ClickOnce from the command-line.
Wednesday, March 08, 2006 10:37 PMthe CCNetLabel comes from the "CruiseControl.net" label the it increments on its own.
Thursday, March 09, 2006 3:12 PMUpon further investigation into the Microsoft.Common.targets file in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, I found the PublishDir property used... Once I added it to the msbuild command line arguments (/p:PublishDir=c:\Inetpub\wwwroot\publish), then msbuild properly built the ClickOnce deployment there... Next up, I need to figure out how to get the folder to auto increment--as done by Visual Studio. All this done to hopefully configure CruiseControl.Net to auto-deploy my ClickOnce project.
Brady P. Merkel
Go Gators! --;==;<
Sunday, August 13, 2006 6:49 AMHas anyone had any luck with msbuild command line generating the publish.htm file? I am able to get it to publish to the directory of my choice (/p:PublishDir) but it does not produce two files... AppName_1_0_0_0.application and publish.htm. Am I missing something?
- Proposed As Answer by Tom Newman WTG Wednesday, May 18, 2011 6:35 PM
Tuesday, August 29, 2006 11:32 AMI'm having trouble with too. Running msbuild from the command line to publish, everything seems identical to running publish from the IDE except the publish.htm file is missing. Does anyone have any ideas?
Tuesday, October 24, 2006 2:11 PMWhen looking at the publish.htm, that file contains no info about what version of all those present is the current one. However, it contains some java script dealing with reg exp which appears to figure those things out for itself. Thus, there should be no reason to actually regenerate that file. The fact that the IDE does regenerate it every time may very well mean nothing at all. In fact I tried exchanging the newly generated file for the file from the last version with no ill effects at all.
I'm also having trouble with the version number thingy. You can supply the version number as a parameter (not bad at all if you execute your msbuild from some other application, like NAnt). However, it doesn't really seem to care what version you supply, so I guess I've got it all wrong.
Tuesday, October 24, 2006 2:15 PMSorry.
I was wrong. Stupidity is a desease hard to cure, so please don't hit me. It'll only make it worse...
Wednesday, November 29, 2006 4:05 PM
This answer is actually wrong...it will publish to the directory of your choice but it doesn't create the Publish.htm. The settings within a .csproj file are msbuild targets, tasks, and properties. The property for where to publish can be passed in.
This works fine:
<Output ItemName="OutputFiles" TaskParameter="TargetOutputs"/>
Since the property can be passed in via an MSBuild script then it can be passed in via commandline too.
Sunday, December 17, 2006 1:59 PM
I'm confused after having read through the above.
So, can I (or can I not) use MSBuild to publish my Win app to a specified URL?
For our app, we must publish it to 10 different servers (10 different contained cattle feed yards). So I would love to have my version ready to be deployed, build it, and then go to the command prompt and be able to type something like:
msbuild /target:publish /property:PublishUrl=http://184.108.40.206/MyApp
msbuild /target:publish /property:PublishUrl=http://220.127.116.11/MyApp
msbuild /target:publish /property:PublishUrl=http://18.104.22.168/MyApp
because then I could write a script to automate the publish to multiple locations instead of having to do it 10x in the VS IDE every time)
But from everything I'm reading, MSBuild will not publish to a URL, but only to a local folder. And it does not handle publish.htm and other needed files.
So should I abandon MSBuild or will it be able to do what I need?
Thursday, March 29, 2007 1:51 PMCouldn't you use msbuild to publish to a local dir on the web server (publishDir), and later put a virtual directory matching publishUrl on top of it so it becomes accessible via your publishUrl?
Wednesday, July 23, 2008 6:15 AMI am able to build the project. But when I specify the Install URL and Publish URL, the user doesn't have access to the path.
So I need to impersonate with some other credential. But I couldn't find any way to provide alternate username and password.
Please let me know, how can I do it.
Once I do this I need to integrate the same to CruseControl.Net for Continuous Integration.
Wednesday, September 03, 2008 8:54 AMAt least the PublishUrl property is actually PublishDir
Thursday, November 06, 2008 5:47 PMHi.
Anyone notice differences in the publish directory, building a sln from the IDE vs cruise control? I'm getting some dll's in different locations (with CC is in the root and with the IDE is in bin).
Tuesday, February 03, 2009 4:32 PMok so forgive me for asking a begginers question here...
I want to publish a click-once application using MSBuild and command scripts. I see a lot of great blogs here for generating the publish.htm and version number. If I have to edit or add MSBuild targets, tasks and properties to the auto-generated *.csproj (of start-up application), where and how do I do it? Or do I create a new file with .csproj extension which calls the other dependent projects to build? Sorry not much of a build expert....
Tuesday, December 08, 2009 12:56 AMtry this for creating the publish.htm file. Version # is a different problem...
Saturday, January 22, 2011 8:22 AM
try this for creating the publish.htm file. Version # is a different problem...
Thanks for releasing the info, It's comprehensive.
Friday, February 18, 2011 4:27 PM
BTW, I found that I had to run the msbuild command using /target:clean,rebuild,publish. Otherwise, the properties I was overriding (ProductName, PublishUrl, ect) weren't used because a prior .application file was being published.
Thursday, July 21, 2011 1:47 PM
Another MSDN page seems to dissagree with this:
- Proposed As Answer by Alden Snow Thursday, July 21, 2011 1:47 PM
Tuesday, July 10, 2012 2:47 PMIf someone working for me told me that they had embedded implementation code in the user interface, then I would be having serious words with them about how to code, and I'm only 27 with 3 years experience. How do Microsoft let this kind of thing happen?