Perazim Perazim - 3 months ago 12
Git Question

Jenkins access msbuild file in github probject

My current situtation



I learning how to write Unit Tests with NUnit 3.4. The whole time I had like 3 Steps.

1.) I write my C#-Project with unit tests

2.) In the same folder where my Solution is, I have a msbuild-file which build my project and creates stuff like:


  • Console-Report.xml

  • MyProject.dll

  • MyProject.pdb

  • MyProject_Test.dll

  • MyProject_Test.pdb

  • nunit.framework.dll

  • nunit.framewirk.xml



3.) I use Jenkins (nunit- und msbuildPlugins are installed): Every time I press "Build now" it calls my msbuild-file in the project folder:

enter image description here

So far, so good.

What I want



Now I want Jenkins to build every time I change and update my code and I read that there are many ways to do that. I want to try it with Github.

1.) I created a new repository "CannonAttack" and imported my project "MyCannonAttack"

2.) I connected more or less Github with Jenkins via this article successfully. See here:
enter image description here

But now I need to run my msbuild-file, which is on github. How can I call/access it? This is my github-project. In the next folder you can finde the msbuild-file.

Answer

Set your MSBuild Build File value to: ${WORKSPACE}\CannonAttack\MyCannonAttack\TestK.msbuild

Or possibly ${WORKSPACE}\MyCannonAttack\TestK.msbuildYou can click on "Workspace" on the left of the job page to see exactly where it is... In case I'm off by one folder in my suggestion. But ${WORKSPACE} is an environment variable that allows you to access the paths that you pull to with source control.