简体   繁体   English

无法加载文件或程序集 Microsoft.Build.Utilities.Core。 为什么 DotNetCompilerPlatform 依赖于旧的 Build.Utilities.Core?

[英]Could not load file or assembly Microsoft.Build.Utilities.Core. Why does the DotNetCompilerPlatform rely on an old Build.Utilities.Core?

I downloaded a sample C# project from github: https://github.com/dotnet/AspNetDocs我从 github 下载了一个示例 C# 项目: https://github.com/dotnet/AspNetDocs

But I got an error message when building: The 'KillProcess' task could not be loaded from the assembly '......Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net472....\tasks\DotNetCompilerPlatformTasks.dll'.但我在构建时收到一条错误消息:无法从程序集“......Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net472....\tasks\ DotNetCompilerPlatformTasks.dll'。 Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0 ,...' or one of its dependencies.无法加载文件或程序集“Microsoft.Build.Utilities.Core, Version=14.0.0.0 ,...”或其依赖项之一。 The system cannot find the file specified.该系统找不到指定的文件。

I am using Visual Studio 2013 update 5. The target framework for my project is .NET Framework 4.8.我正在使用 Visual Studio 2013 更新 5。我的项目的目标框架是 .NET Framework 4.8。

And I have installed the Nuget packages: Microsoft.CodeDom.Providers.DotNetCompilerPlatform v3.6.0 Microsoft.Build.Utilities.Core v16.9.0我已经安装了 Nuget 包: Microsoft.CodeDom.Providers.DotNetCompilerPlatform v3.6.0 Microsoft.Build.Utilities.Core v16.9.0

According to the error message, it seems that the Nuget package DotNetCompilerPlatform needs an old Build.Utilities.Core v14.0.0.0 while the one I have installed is the latest version V16.9.0.根据错误消息,似乎 Nuget package DotNetCompilerPlatform 需要旧的 Build.Utilities.Core v14.0.0.0 而我安装的是最新版本 V16.9.0。

But I failed to nuget Install-Package the v14.0.0.0 after I Uninstall-Package v16.9.0.但是在我卸载-Package v16.9.0 之后,我未能 nuget Install-Package v14.0.0.0。

Is it possible to config the DotNetCompilerPlatform in order to use the latest Build.Utilities.Core?是否可以配置 DotNetCompilerPlatform 以使用最新的 Build.Utilities.Core?

Thank you all.谢谢你们。 Have a good weekend.有一个美好的周末。

In my side , I found that the issue is related to the verification of these installed NuGet packages on the local computer.在我这边,我发现问题与在本地计算机上验证这些已安装的 NuGet 包有关。

First of all , you should make the full path of ProductsApp folder a bit shorter。 Otherwise, you will face the problem of The fully qualified file name must be less than 260 characters .首先,你应该把ProductsApp文件夹的完整路径缩短一点。否则,你将面临The fully qualified file name must be less than 260 characters的问题。

So you have to copy the ProductsApp folder into C:\ or D:\ directly and then open it under VS IDE on that path.因此,您必须将ProductsApp文件夹直接复制到C:\D:\中,然后在该路径上的 VS IDE 下打开它。

After that, reinstall the nuget packages once.之后,重新安装一次 nuget 软件包。

Run

update-package -reinstall under Tools --> Nuget Package Manager --> Package Manager Console update-package -reinstall -工具下重新安装 --> Nuget Package 管理器--> Package 管理器控制台

After that, if you still face the issue, you have to add bindredirect for that new dll under web.config file and it can use the latest one if you uses the functiion from the latest one.之后,如果您仍然遇到问题,则必须在web.config文件下为新的 dll 添加bindredirect ,如果您使用最新的功能,它可以使用最新的。 And it just cannot find the old version of the dll since you have used the code from the old one under code editor.它只是找不到旧版本的 dll,因为您在代码编辑器下使用了旧版本的代码。

The workaround is to add bindredirect for it:解决方法是为其添加 bindredirect:

1) open web.config file: 1)打开web.config文件:

2) add these: 2)添加这些:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      .....
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="xxx" />
        <bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
 </runtime>

3) then delete bin and obj folder and then rebuild again. 3)然后删除binobj文件夹,然后再次重建。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集 Microsoft.Build.Utilities.Core - Could not load file or assembly Microsoft.Build.Utilities.Core 找不到Microsoft.Build.Utilities.Core程序集 - Microsoft.Build.Utilities.Core assembly not found 无法加载文件或程序集“Microsoft.Build.Utilities.Core,Version=14.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a” - Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Microsoft.Build.Utilities,Microsoft.Build.Utilities.v3.5,Microsoft.Build.Utilities.v4.0的单独项目 - Separate projects for Microsoft.Build.Utilities, Microsoft.Build.Utilities.v3.5, Microsoft.Build.Utilities.v4.0 FileLoadException:无法加载文件或程序集'Microsoft.AspNetCore.SignalR.Core - FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.SignalR.Core 无法加载文件或程序集“Microsoft.CodeDom.Providers.DotNetCompilerPlatform 或其依赖项之一。” 访问被拒绝 - Could not load file or assembly 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform or one of its dependencies. Access is denied 无法加载文件或程序集“Microsoft.Build.Framework”(VS 2017) - Could not load file or assembly 'Microsoft.Build.Framework'(VS 2017) 我在哪里可以找到Microsoft.Build.Utilities.v3.5 - Where can I find Microsoft.Build.Utilities.v3.5 Microsoft.Build.Utilities.ToolLocationHelper :: GetPathToStandardLibraries(MonoAndroid)-如何解决这个问题? - Microsoft.Build.Utilities.ToolLocationHelper::GetPathToStandardLibraries(MonoAndroid) - How to solve this? .NET实用程序的替代构建系统 - Alternative build system for .NET utilities
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM