Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins msbuild deploy to remote IIS

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

like image 886
Yariv Katz Avatar asked Jul 11 '17 12:07

Yariv Katz


1 Answers

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

  • https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/command-line-deployment
like image 122
Yasirmx Avatar answered Nov 07 '22 09:11

Yasirmx