Command line MSBuild 4 and MSDeploy

I am trying to automate the deployment of a site. I started with this article

and everything works fine with VS 2010. However, I am having problems with the command line. I use this

c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "d:\Projects\test.csproj" /T:Package /P:PackageLocation="d:\Package\packageTest.zip" 

to create a package

and

 d:\Projects\packageTest.deploy.cmd "-setParam:name='IIS Web Application Name',value=MSBuild/Test2" /y 

to at least deploy correctly. However, it does not accept any of the IIS parameters (the application pool is MSBuild instead of ASP.NET v2.0), and, as I said, the name of the IIS web application is erroneous. Should this information not be extracted from a .csproj file? All these settings are made for the debug configuration and platform of any cpu

+7
msbuild msdeploy
source share
1 answer

Usually you first configure your application on IIS, with the correct path, application pool, etc. When configuring, you can use MSBuild to deploy the application into this name as follows:

 msbuild <your_web_project_name>.csproj /p:Configuration=Release /p:OutputPath=bin /p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MsDeployServiceUrl=https://<url_to_your_server>:8080/msdeploy.axd /p:username=<username> /p:password=<password> /p:AllowUntrustedCertificate=True /p:DeployIisAppPath=<your_site_name> /p:MSDeployPublishMethod=WMSVC /p:VisualStudioVersion=11.0 

If you do not want to configure the site manually, you can run a power shell that looks something like this:

 Import-Module WebAdministration New-Item iis:\Sites\<your_site_name> -bindings @{protocol="http";bindingInformation=":80:<your_site_name>} -physicalPath c:\inetpub\wwwroot\<your_site_name> Set-ItemProperty 'IIS:\Sites\<your_site_name>' ApplicationPool "ASP.NET v4.0" 
+6
source share

All Articles