-1

So I am using Jenkins and building an application with c#. First I ran Jenkins on my local machine, and I got it working fine. The next step was to build it from an external server running its own copy of Jenkins. When I do this I get the following warning:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\ConsoleApp2\ConsoleApp2.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\ConsoleApp2\ConsoleApp2.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\ConsoleApp2\ConsoleApp2.csproj]

which I believ leads to the following error:

UnitTest1.cs(10,21): error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj] UnitTest1.cs(9,10): error CS0616: 'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute' is not an attribute class [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj] UnitTest1.cs(18,10): error CS0616: 'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute' is not an attribute class [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj] UnitTest1.cs(26,10): error CS0616: 'Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute' is not an attribute class [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj] UnitTest1.cs(26,35): error CS0616: 'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute' is not an attribute class [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj] UnitTest1.cs(6,6): error CS0616: 'Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute' is not an attribute class [C:\Program Files (x86)\Jenkins\workspace\Joshua_Jenkins_Freestyle\UnitTestProject1\UnitTestProject1.csproj]

been trying to figure it out with no success.

First thing I tried was to set the target version of my project to the same .Net framework as the one the external Jenkins server was using (4.6), in the project references. that didn't work.

Any help is appreciated.

Joshua Vandenbor
  • 509
  • 3
  • 6
  • 19
  • Version 4.6 and 4.6.1 are different. – PmanAce May 31 '18 at 16:59
  • Have you tried installing .net 4.6.1 on your external server? – PmanAce May 31 '18 at 18:02
  • @PmanAce Well, I myself dont have access to do that, as my work only permits certain user accounts to access it. I have put in a request for them to do that, but I want to know if there is anything else that I can do in the meantime. Especially if it turns out thats not the issue – Joshua Vandenbor May 31 '18 at 18:23
  • Take a look at this maybe: https://stackoverflow.com/questions/22822406/you-must-add-a-ref-to-system-runtime – PmanAce May 31 '18 at 18:34

1 Answers1

0

so I figured out a solution in a way, although it kind of avoids the problem. I am now using VSTest instead, and it seems to be working fine enough. Although I do recognize its bad practice to download user software onto a server.

Joshua Vandenbor
  • 509
  • 3
  • 6
  • 19