我正在尝试运行ASP。NET MVC(模型-视图-控制器)项目从TFS (Team Foundation Server)源代码控制检索。我已经添加了所有程序集引用,我能够成功地构建和编译,没有任何错误或警告。

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

找不到路径的一部分 “C: \ B8akWorkspace \ B8akProject \ B8akSolution \ B8AK.Portal \ bin \ roslyn \ csc.exe”。

以下是错误页面的完整截图。

经过几天的研究,我了解到Roslyn是一个提供高级编译特性的. net编译器平台。但是,我不明白为什么我的构建试图找到\bin\roslyn\csc.exe,因为我没有配置任何与roslyn相关的东西。我也没打算让罗斯林参与我的项目。


当前回答

删除解决方案资源管理器中的Bin文件夹并重新生成解决方案。这样问题就解决了

其他回答

我的解决方案是使用Nuget更新以下项目到最新版本: ——Microsoft.Net.Compilers ——Microsoft.CodeDom.Providers.DotNetCompilerPlatform 然后重建项目。因为我的项目是一个网站所以没有*。csproj文件。 当我试图在浏览器中查看cshtml时,出现上面的错误。

上述两项更新到最新版本后,错误修复。 我在VS2015和windows7 SP1

我在Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.06上有这个错误,但在@ prisoner erzero上也有1.0.7的错误。然而,当微软发布1.0.8 2017-10-18时,它终于开始为我工作了,我不必降级。

https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/

下面为我解决了这个问题:

更新到Visual Studio 2017的最新版本(使用安装程序应用程序) 清理并重新构建解决方案

The answer for this is different for Website project and Web application Project. The underlying issue is same that NuGet package is behaving differently on different machine. It may be rights issue or some execution policy which stops it from copying to Bin folder As you know Roslyn is new compiler. you should have it in Bin folder for these Projects Go to your website NuGet Packages check this Folder Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0 \code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0 Do you see it ? Can you see code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\tools\RoslynLatest in it Now as part of compiling this Folder should get copied to your website under bin like this. \code\WebSite1\Bin\Roslyn some how that is not happening for you . Try running Visual studio as Admin . Copy Roslyn folder manually. Try uninstall and install of NuGet Package. Remember this package compile your folder and if its not there you cannot compile anything and so you cannot add anything too. Try copying this package to offline version tools -> options-> nuget package Manager->Package source-> Microsoft Visual Studio Offline Packages C:\Program Files (x86)\Microsoft SDKs\NuGetPackages

我按照这些步骤做了,效果非常好

删除所有bin和obj文件夹 清洁解决方案和重建 在powershell中执行该命令

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