Code publish through jenkins for .net MVC solution

2019-06-11 13:55发布

问题:

We have setup a jenkins CI build environment in ubuntu for .net code base.

Following are the steps performed in jenkins and found to be working fine: - Get code base repository from git. - Build the code base using 'XBuild'. Build is possible with Release mode as well.

Post build, the issue we are facing is with publishing the build code. We are able to follow above listed steps, build with MSBuild and publish in Windows. But in Ubuntu, we are unable to publish (locally or externally) as the command line parameters (in shell window) to publish '/p:proj_file_pub.xml' does not work with Ubuntu XBuild build.

We also have mono tool installed in Ubuntu for manually building the .net codebase. In case we can do publish using mono with any shell command, then please do let us know the same.

I would re-iterate the requirement, to build the .net codebase in Jenkins and publish to local or external server. Firstly, we are looking to publish the code locally.

Please suggest appropriate shell command to publish the code base in Ubuntu machine using Jenkins.

PS: The code base is an MVC web application.

回答1:

Success!!!.

After lot of research found that the command to publish a website locally using xbuild in ubuntu is with following command...

xbuild ./sandbox/sandbox.csproj /t:Build /p:OutputPath="/var/code/build" /p:Configuration="Release"

Important parameter to note while publishing in above command is /p:OutputPath. We need to set appropriate path for "OutputPath" for it to publish accordingly.

The published website would be under the path such as /var/code/build/website/Publish_Website folder (not sure of the actual path).

Same command could be used with Jenkins as a shell command to publish website post CI build.

Hope this information helps.