The specified task executable location "...\packages\Microsoft.Net.Compilers.1.3.2\build\..\tools\csc.exe" is invalid
Asked Answered
B

2

8

I downloaded my code from TFS to a new folder on my C: but it seems Im having trouble with the compiler it seems.

I deleted the .suo file but I still have the same problem and 68 warnings.

Because I never encountered such a problem I dont know which information is relevant to post here in order to solve it, this is what I see in the error list:

Severity Code Description Project File Line Suppression State Error The specified task executable location "C:\Projects\GigHub\packages\Microsoft.Net.Compilers.1.3.2\build..\tools\csc.exe" is invalid. GigHub

Now the thing is, csc.exe does not exist on that folder. Also, Im seeing a lot of warnings in regards of different files.

Brownson answered 4/6, 2018 at 17:50 Comment(0)
I
11

Reason

Your project is set to use a .NET Compiler package for building and compiling assemblies.

By default, the compiler lives in the .NET framework folder:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe

But if your project includes a .NET Compiler package then an alternative compiler will be used from within your project:

YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\csc.exe

It could be that the internal compiler package was not added to your repository correctly. Try the following steps and make sure everything is added to your source control.

Solution

You need to either Uninstall or 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. For me it worked and unless you really need that package, you can leave it out. Be careful as the new versions support for example C# 6+ and you might need it to use the latest language features.
  6. If you need the 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.
Iona answered 18/6, 2018 at 16:25 Comment(0)
S
0

I faced the same error. My solution was to delete the packages folder. After rebuilding the solution, it worked.

Supinator answered 4/8 at 20:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.