Jenkins msbuild deploy to remote IIS

iisJenkinsmsbuild

I have a Jenkins build server and a remote IIS server.
I would like my Jenkins server to build and deploy to the IIS using MSBuild and publish profile I created.
The publish profile is created from Visual Studio and it's working fine when publishing from VisualStudio.
I'm running the following command from the Jenkins Server:

msbuild myproject.csproj /p:DeployOnBuild=True /p:PublishProfile=CustomProfile /p:VisualStudioVersion=14.0 /p:AllowUntrustedCertificate=True

The build is success but the files are not published to the IIS and there is no error reported.

Can anyone help me understand what is the right MSBuild command that will also publish the new version to the IIS server.

Thanks

Best Answer

As stated on Microsoft's website:

To deploy to Azure, you must add the password to the command line. If you saved the password in the publish profile in Visual Studio, it was stored in encrypted form in the your .pubxml.user file. That file is not accessed by MSBuild when you do a command line deployment, so you have to pass in the password in a command line parameter.

Your command should include the password parameter:

msbuild myproject.csproj 
  /p:DeployOnBuild=true 
  /p:PublishProfile=CustomProfile 
  /p:Password=hdNSWsbuqno7J5uqnwKafwlfNPt1DSco7J5uqnwKafwlfNPt1DSpKHuYgCco7J5 
  /p:AllowUntrustedCertificate=true

Your password is found in .publishsettings

References

Related Topic