Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6797829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:39:25+00:00 2026-05-26T18:39:25+00:00

I want to know how to publish from PowerShell the same way I can

  • 0

I want to know how to publish from PowerShell the same way I can from Visual Studio.

When you launch Visual Studio with MVC project for example; then right-click on the project and select “Publish”; a dialog box comes up that you fill out a few settings in the click Publish again. It magically pushes your website out as expected. It also creates a file to hold those settings. projectName.Publish.xml.

That file is the reason I want to be able to use this in exactly the same manner. There are a couple of settings that could manipulated in powershell to push the application to multiple sites with differing configurations.

I have looked at “msbuild target:publish” which only produces (run from the directory containing the .csproj):

MSBUILD : error MSB1009: Project file does not exist.
Switch: target:publish 

I have tried “msbuild projectfile target:publish” which produces:

MSBUILD : error MSB1008: Only one project can be specified.
Switch: target:build

I’ve also looked at several msdeploy variations. It can’t be this difficult!? If you can right-click in studio there has be something that performs that task.

I’m starting to wonder if this requires a full moon and cutting the head off a chicken. (I’ve spent to much time on this!)

**EDIT: I tried Lee’s suggestion:

msbuild target:publish Mvc.csproj

Which produces this error:

MSBUILD : error MSB1008: Only one project can be specified.
Switch: Mvc.csproj

For switch syntax, type "MSBuild /help"

**EDIT: From DaveE’s suggestion, I tried:

msbuild target:publish Mvc.csproj

Which produces this error:

MSBUILD : error MSB1009: Project file does not exist.
Switch: target:publish=PassportHealth.PatientSimple.Mvc.csproj

I also went back to the documentation for the “Publish” target (http://msdn.microsoft.com/en-us/library/ms165431.aspx) which seems pretty clear that the syntax is:

msbuild target:publish

So after rereading this several times my conclusion is this: the publish target is for one-click deployments of .exe files not MVC web sites. I have found http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx which speaks to this matter fairly clearly. I don’t see how to utilized the “publish.xml” file in this via the msdeploy command yet though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:39:26+00:00Added an answer on May 26, 2026 at 6:39 pm

    The projectName.publish.xml files are only used via Visual Studio for the One-Click publishing. For MSBuild, you need to pass a bunch of parameters directly on the commandline (/p:Param1=value1;Param2=value2;…). For example:

    /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=InProc /p:MSDeployServiceUrl=localhost /p:DeployIisAppPath="Default Web Site/NewOrleansJazz" /p:UserName=domain\user /p:Password=myPassword (source)

    Note that in the VS11 Preview (released at the BUILD conference), there is a new file replacing the projectName.publish.xml: MyPublishSettings.pubxml. This file is basically a combination of the publish.xml file and the projectName.wpp.targets rolled into one (yet also split for each profile instead of having them all saved into publish.xml, e.g. TestSettings.pubxml, ProductionSettings.pubxml), and can be used from the command line in a simpler fashion using msbuild MyProject.csproj /t:WebPublish /p:PublishProfile="myProfile"

    [edit:] a couple notes re: the info in your post:

    1. The error about only specifying a single project is probably due to specifying the target incorrectly. Other than the project name, all parameters passed to msbuild start with a /, e.g. /t[arget]:foo /p[roperty]:var=value
    2. The Publish target is actually not related to Web Publishing. IIRC, it’s related to publishing a OneClick application. In VS2010, you should use /t:build /p:DeployOnBuild=true for Web projects to use the publishing tasks (as used above). New in VS11 is the /t:WebPublish which also takes a simpler set of parameters, namely the .pubxml file you wish to use.
      • additional note: when building a solution file, /t:WebPublish will fail as the target is not defined at the solution level. It can only be used directly on the project file for your Web project. You can still use /p:DeployOnBuild=true at the solution level as the parameter value is passed to each project being built, but will be ignored by any projects not consuming that value.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how to simply publish over http = much like Mercurial
I want to know which tool can be used to measure the cyclomatic complexity
I want to know if i can create a custom google maps application,on which
I want to show user's post count from specific category. Currently, I can only
Is there a way I can publish *.ascx files without adding them to my
I want to publish the same post which I just published in the worpress
I am new to iphone development and want to know that how to publish
Want to know what the stackoverflow community feels about the various free and non-free
want to know why String behaves like value type while using ==. String s1
I want to know what a virtual base class is and what it means.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.