升级后由构建添加的错误版本的mscorlib(尝试加载具有不正确格式的程序)

问题描述 投票:0回答:1

我正在开发一个最近从4.0升级到Sitecore 8.2和.NET framework 4.6的项目。当我在本地构建它我的网站工作,但在我的测试环境中,我使用msbuild在Jenkins中构建,mscorlib dll导致导致编译错误:

Could not load file or assembly 'file:///E:\inetpub\wwwroot\mysite\Website\bin\mscorlib.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

在我的项目中没有对mscorlib的引用,因为这个dll是由构建系统自动引用的,所以我不确定如何修改或更新它。

MSBuild中的行记录了添加它的位置:

Copying file from "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" to "bin\Release\mscorlib.dll".

此外,当我在Visual Studio中构建我的项目时,它不会将mscorlib.dll复制到我的bin中,因此我不确定为什么会在Jenkins构建中发生这种情况,而不是我的本地环境。

jenkins dll msbuild .net-4.6 mscorlib
1个回答
0
投票

默认情况下,它是从C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \添加dll,我需要它来使用C:\ Windows \ Microsoft.NET \ Framework65 \ v4.0.30319 \中的版本。我添加了一个带有正确路径的csproj文件的引用:

<Reference Include="mscorlib">
  <HintPath>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll</HintPath>
</Reference>
© www.soinside.com 2019 - 2024. All rights reserved.