Bug 59143 - error MSB3082: Task failed because "csc.exe" was not found
Summary: error MSB3082: Task failed because "csc.exe" was not found
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.0 (2017-02)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2017-08-31 11:14 UTC by David Bimmler
Modified: 2017-10-12 11:28 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 59143 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description David Bimmler 2017-08-31 11:14:10 UTC
Attempting to use the packaged MSBuild on Windows fails with the following error message:

"C:\Users\me\project\CsharpWorker.sln" (default target) (1) ->
"C:\Users\me\project\CsharpWorker.csproj" (default target) (2) ->
"C:\Users\me\project\GeneratedCode.csproj" (default target) (3:2) ->
(CoreCompile target) ->
  C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB3082: Task failed because "csc.exe" was not found, or the .NET Framework v4.0 is not installed.  Please insta ll the .NET Framework v4.0. [C:\Users\me\project\GeneratedCode.csproj]

I dug a bit deeper, and according to https://msdn.microsoft.com/en-us/library/ms164309.aspx there should be a "csc.exe" in the MSBuildToolsPath (for mono 5.2 x64 that's C:\Program Files\Mono\lib\mono\msbuild\15.0\bin). There isn't one, which makes my build fail. I can see that there is a csc.exe in C:\Program Files\Mono\lib\mono\4.5 though.

(This is Windows 10, 64-bit)
Comment 1 Arsen.Shnurkov 2017-09-28 16:03:34 UTC
the same error on Gentoo Linux
Comment 2 Ankit Jain 2017-09-29 17:32:49 UTC
@Arsen, I am not sure you built msbuild correctly. Try `$ make && ./install-mono-prefix.sh <prefix>`. The error being discussed here is for mono's fork of msbuild, built and packaged by us.

@david, Where did you get the package from? Could you please try a more recent version? And if it still doesn't work then could you attach the diag build log? Build with `$ msbuild foo.sln /fl /flp:v=diag` and attach the generated `msbuild.log`.
Comment 3 David Bimmler 2017-10-12 11:28:57 UTC
@Ankit that was Mono 5.2 64-bit from the website, not sure what version it was exactly.

The log below is for mono 64-bit from https://download.mono-project.com/archive/5.2.0/windows-installer/mono-, freshly installed on a Windows 10 64-bit.

The error still persists, as requested here is the msbuild.log for the diag verbosity: