找不到路径的一部分... bin oslyncsc.exe [英] Could not find a part of the path ... bin oslyncsc.exe

查看:34
本文介绍了找不到路径的一部分... bin oslyncsc.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行从 TFS 源代码管理中检索的 Asp.net MVC 项目.我已经添加了所有程序集引用,并且能够成功构建和编译而没有任何错误或警告.

I am trying to run Asp.net MVC project retrieved from TFS source control. I have added all assembly references and I am able to build and compile successfully without any error or warning.

但我在浏览器中收到以下错误:

But I get the following error in the browser:

找不到路径的一部分'C:B8akWorkspaceB8akProjectB8akSolutionB8AK.Portalin oslyncsc.exe'.

Could not find a part of the path 'C:B8akWorkspaceB8akProjectB8akSolutionB8AK.Portalin oslyncsc.exe'.

这是错误页面的完整屏幕截图.

Here is a full screenshot of the error page.

经过几天的研究,我了解到 Roslyn 是提供高级编译功能的 .Net 编译器平台.但是,我不明白为什么我的构建试图找到 in oslyncsc.exe,因为我没有配置任何与 Roslyn 相关的东西,也没有打算在我的项目中使用 Roslyn.

After few days of research, I understood that Roslyn is .Net compiler platform that offers advance compiling features. However, I do not understand why my build is trying to find in oslyncsc.exe because I did not configure anything related to Roslyn nor I intend to use Roslyn in my project.

推荐答案

TL;博士

在包管理器控制台中运行:

run this in the Package Manager Console:

更新包 Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

更多信息

此问题与 Visual Studio 本身无关,因此建议添加构建步骤以复制文件的答案是一种解决方法.与手动向项目添加编译器二进制文件相同.

This problem is not related to Visual Studio itself, so answers suggesting adding build steps to copy files over are rather a workaround. Same with adding compiler binaries manually to the project.

Roslyn 编译器来自 NuGet 包,并且该包的某些版本中存在/曾经存在错误(我不知道究竟是哪个版本).解决方案是重新安装/升级该软件包到无错误版本.最初在 2015 年我写下答案之前,我通过在特定版本安装以下软件包来修复它:

The Roslyn compiler comes from a NuGet package and there is/was a bug in some versions of that package (I don't know exactly which ones). The solution is to reinstall/upgrade that package to a bug-free version. Originally before I wrote the answer back in 2015 I fixed it by installing following packages at specific versions:

  • Microsoft.Net.Compilers 1.1.1
  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.1

然后我查看了 .csproj 并确保包的路径是正确的(在我的例子中是 ....packages*.*)在顶部的标签 中并在 底部带有名称EnsureNuGetPackageBuildImports".这是基于 MVC 5 和 .NET Framework 4.5.2.

Then I looked into .csproj and made sure that the paths to packages are correct (in my case ....packages*.*) inside tags <ImportProject> on top and in <Target> with name "EnsureNuGetPackageBuildImports" on the bottom. This is on MVC 5 and .NET Framework 4.5.2.

这篇关于找不到路径的一部分... bin oslyncsc.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆