指定的任务可执行位置......csc.exe is invalid 错误 [英] The specified task executable location ......csc.exe is invalid error

查看:47
本文介绍了指定的任务可执行位置......csc.exe is invalid 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 TFS 的项目,它在其他人的机器上运行,除了我的.在构建时,我得到了可以在图像中看到的错误.指定的任务可执行位置 csc.exe 无效."目前正在尝试修复 VS 2017.

解决方案

根据消息,csc.exe 似乎已损坏.

只需尝试以下事情来缩小问题范围:

  • 导航到 Microsoft.Net.Compilers 包位置,删除包文件夹,然后重建.一般会打包成在构建过程中自动恢复.

    YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.2.6.1

  • 卸载并重新安装 Microsoft.Net.Compilers 包:

    1. 打开 Visual Studio
    2. 转到工具 -> NuGet 包管理器 -> 管理解决方案的 NuGet 包
    3. 转到已安装标签并找到Microsoft.Net.Compilers
    4. 从您的项目中卸载包
    5. 立即尝试构建您的项目.(因此它将使用位于 .NET 框架文件夹中的默认编译器:C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe)
    6. 如果您确实需要 Microsoft.Net.Compilers 软件包,请继续在 浏览 选项卡中找到它并安装最新的稳定版版本.
    7. 构建项目,如果一切正常,请确保将更改提交到代码存储库.

  • 您也可以尝试运行以下命令卸载并重新安装包管理器控制台中的 Nuget 包:请参阅 Microsoft.Net.Compilers >

    卸载包 Microsoft.Net.Compilers -Version 2.6.1

    Install-Package Microsoft.Net.Compilers -Version 2.6.1

I have a project on TFS that is working on everyone else's machine, except mine. When building I get the error that can be seen in the image. "The specified task executable location csc.exe is invalid." currently trying to repair VS 2017 now.

解决方案

Based on the message, seems the csc.exe is damaged.

Just try below things to narrow down the issue:

  • Navigate to the Microsoft.Net.Compilers package location, delete the package folder, then rebuild. Generally the package will be restored automatically during the build.

    YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.2.6.1

  • Uninstall and Re-install the Microsoft.Net.Compilers package:

    1. Open Visual Studio
    2. Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
    3. Go to Installed tab and find Microsoft.Net.Compilers package
    4. Uninstall the package from your project
    5. Try to build your project now. (Thus it will use the default compiler which lives in the .NET framework folder: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe)
    6. If you really need the Microsoft.Net.Compilers package then go ahead and find it in the Browse tab and install the latest stable version.
    7. Build the project and if everything works, make sure you commit changes to your code repository.

  • You can also try to run below command to uninstall and reinstall the Nuget packages from the Package Manager Console: See Microsoft.Net.Compilers

    Uninstall-Package Microsoft.Net.Compilers -Version 2.6.1

    Install-Package Microsoft.Net.Compilers -Version 2.6.1

这篇关于指定的任务可执行位置......csc.exe is invalid 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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