msbuild failure from Jenkins

Ask general questions here.
jonny
Posts: 9
Joined: Thu Oct 31, 2019 4:24 pm

msbuild failure from Jenkins

Post by jonny » Tue Oct 20, 2020 5:37 pm

Hi

I have a project running fine on my local machine. I have a 2019 Windows server with a remote agent and a floating run time license. My gitignore file is this:

Code: Select all

*bin/
*obj/
*Reports/
*.rxlog
*.rxuser
[Rr]eports
*.rxlog
*.rxlog.data
*.jpg
*.rxuser
*.pref
Currently my packages directory is not within the git remote repo either. These were not automatically tracked when I first pushed using tortoise and I wasn't sure whether they should be or not? Although I am a dev, I haven't used C# much and in most other programming languages you don't commit the packages, just the references to them and use a build tool to pull them down. So I assume the same here.

When I try to build this on the remote machine I get a load of warnings or errors such as:

Code: Select all

error CS0234: The type or namespace name 'Testing' does not exist in the namespace 'Ranorex.Core' (are you missing an assembly reference?) [E:\jenkins\workspace\ranorex\RanorexAutomationHelpers\Ranorex Automation Helpers.csproj]

Code: Select all

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Ranorex.Bootstrapper". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [E:\jenkins\workspace\ranorex\RanorexAutomationHelpers\Ranorex Automation Helpers.csproj]
In total:

23 Warning(s)
153 Error(s)

Code: Select all

Done Building Project "E:\jenkins\workspace\ranorex\RanorexAutomationHelpers\Ranorex Automation Helpers.csproj" (defaul
t targets) -- FAILED.

Done Building Project "E:\jenkins\workspace\ranorex\abc\abc.csproj" (default targets) -- FAILED.

Done Building Project "E:\jenkins\workspace\ranorex\abc.sln" (build target(s)) -- FAILED.
So I'm assuming that the packages are not built when I use msbuild. I am using the msbuild within the .NET framework 4.62.

Code: Select all

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
I don't have Ranorex itself installed on that machine.

So it seems that msbuild can also restore packages when https://docs.microsoft.com/en-us/nuget/ ... ld-command.

Code: Select all

msbuild -t:build -restore
But when I run that I get:

Code: Select all

MSBUILD : error MSB1001: Unknown switch.
Switch: -restore
I'm, not entirely sure I'm going down the right path to fix, so thought I'd ask

jonny
Posts: 9
Joined: Thu Oct 31, 2019 4:24 pm

Re: msbuild failure from Jenkins

Post by jonny » Tue Oct 20, 2020 7:44 pm

Ok I fixed this by installing nuget and running

Code: Select all

nuget restore abc.sln
Then building and by installing Ranorex itself. Even though we don't have a license for it to run on this machine