1

I'm trying to execute the publish profile from the command line.

  1. Created a publish profile in Visual Studio (right click project -> publish)
  2. Verified that it works. When I press publish, the stuff goes where it is supposed to go (FTP site)

Now I'd like to do this from TFS and that means MSBuild.

From the command line, I tried this:

msbuild.exe WebApplication1.csproj /p:DeployOnBuild=true;PublishProfile="ftp";Password={INSERT-PASSWORD}

I receive no error. And the files are not published on the FTP site. The name of the publish profile is ftp.pubxml. It is physically here:

WebApplication1\Properties\PublishProfiles\ftp.pubxml

That's where Visual Studio 2012 puts it by default.

I'm using FTP deploy, not Web Deploy. No Click Once. A lot of the stuff online talks about those two. This is a boring, old FTP deploy.

Related Question on SO here

Community
  • 1
  • 1
101010
  • 14,866
  • 30
  • 95
  • 172

1 Answers1

5

I have just posted a blog at http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx which will hopefully clear this up for you.

FTP publishing is not supported on the command line. You would receive an error letting you know this, but your command line is missing one very significant property

/p:VisualStudioVersion=11.0

I have blogged about this property in more detail at http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx. To summarize this, the VisualStudioVersion property was introduced to allow VS 2010 and VS 2012 share project files and solutions. If you do not specify a value for this property, it will be defaulted to 10.0.

In your case, since you are building the project you will need to specify this property. Since you didn't specify the value, it defaulted to 10.0 and the build+publish process used was that from VS 2010. Evidently you have both VS2010 + VS2012 installed on your machine.

If you passed in the property /p:VisualStudioVersion=11.0 the error you would have received should let you know that FTP publishing is not supported from the command line.

Note: If you do want us to support command line publishing for FTP the best thing to do is open a suggestion at aspnet.uservoice.com.

Sayed Ibrahim Hashimi
  • 43,864
  • 17
  • 144
  • 178