首页 文章

.Net框架和架构在Jenkins上的不匹配

提问于
浏览
-1

所以我使用Jenkins并使用c#构建应用程序 . 首先,我在我的本地机器上运行Jenkins,并且我的工作正常 . 下一步是从运行自己的Jenkins副本的外部服务器构建它 . 当我这样做时,我收到以下警告:

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]

我相信会导致以下错误:

UnitTest1.cs(10,21):错误CS0012:类型'System.Attribute'在未引用的程序集中定义 . 您必须添加对程序集'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):错误CS0616:'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute'不是属性类[C:\ Program Files(x86)\ Jenkins \ workspace \ Joshua_Jenkins_Freestyle \ UnitTestProject1 \ UnitTestProject1.csproj] UnitTest1.cs(18,10):错误CS0616:'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute'不是属性类[C:\ Program Files(x86)\ Jenkins \ workspace \ Joshua_Jenkins_Freestyle \ UnitTestProject1 \ UnitTestProject1.csproj] UnitTest1.cs(26,10):错误CS0616:'Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute'不是属性类[C:\ Program Files(x86)\ Jenkins \ workspace \ Joshua_Jenkins_Freestyle \ UnitTestProject1 \ UnitTestProject1.csproj] UnitTest1.cs(26,35):错误CS0616:'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute'不是属性类[C:\ Program Files(x86)\ Jenkins \ workspace \ Joshua_Je nkins_Freestyle \ UnitTestProject1 \ UnitTestProject1.csproj] UnitTest1.cs(6,6):错误CS0616:'Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute'不是属性类[C:\ Program Files(x86)\ Jenkins \ workspace \ Joshua_Jenkins_Freestyle \ UnitTestProject1 \ UnitTestProject1.csproj]

一直试图找出它没有成功 .

我尝试的第一件事是在项目引用中将我的项目的目标版本设置为与外部Jenkins服务器使用的相同的.Net框架(4.6) . 那没用 .

任何帮助表示赞赏 .

1 回答

  • 0

    所以我在某种程度上找到了解决方案,尽管它避免了这个问题 . 我现在正在使用VSTest,它似乎工作得很好 . 虽然我确实认识到将用户软件下载到服务器上的不良做法 .

相关问题