Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 578
Nickso Avatar asked Jun 04 '18 17:06

Nickso


1 Answers

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.
like image 105
E2rdo Avatar answered Oct 30 '22 21:10

E2rdo