Bug 60340 - Csc msbuild task fails to find csc.exe
Summary: Csc msbuild task fails to find csc.exe
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.4 (2017-06)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2017-10-24 03:18 UTC by Alexander Köplinger [MSFT]
Modified: 2017-10-24 15:45 UTC (History)
2 users (show)

Is this bug a regression?: Yes
Last known good build: 5.2

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alexander Köplinger [MSFT] 2017-10-24 03:18:20 UTC
Looks like we broke this in 5.4, repro:

> <Project>
> 	<Target Name="BuildMe">
> 		<Csc Sources="Class1.cs" TargetType="Library" OutputAssembly="mylib.dll" />
> 	</Target>
> </Project>

> using System;
> namespace Repro {
>     public class Class1 {
>     }
> }

> $ msbuild repro.proj /t:BuildMe
> Microsoft (R) Build Engine version (master/5bb58816 Thu Oct 19 12:11:52 EDT 2017) for Mono
> Copyright (C) Microsoft Corporation. All rights reserved.
> Build started 10/24/2017 5:08:39 AM.
> Project "/Users/alexander/dev/test/csctask/repro.proj" on node 1 (BuildMe target(s)).
> /Users/alexander/dev/test/csctask/repro.proj(3,3): error MSB3082: Task failed because "csc.exe" was not found.
> Done Building Project "/Users/alexander/dev/test/csctask/repro.proj" (BuildMe target(s)) -- FAILED.
> Build FAILED.
> "/Users/alexander/dev/test/csctask/repro.proj" (BuildMe target) (1) ->
> (BuildMe target) ->
>   /Users/alexander/dev/test/csctask/repro.proj(3,3): error MSB3082: Task failed because "csc.exe" was not found.
>     0 Warning(s)
>     1 Error(s)
> Time Elapsed 00:00:00.33

This seems to be related to the symlink change in https://github.com/mono/mono/pull/5251.

If I add a symlink for csc.exe to /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Roslyn/
 the build works fine.
Comment 1 Ankit Jain 2017-10-24 10:20:27 UTC
Roslyn doesn't fallback to framework path anymore. And our fix kicks in only if the default msbuild targets are imported, which is not the case here. I'll open a PR to add the symlinks.
Comment 2 Ankit Jain 2017-10-24 11:08:15 UTC
PR: https://github.com/mono/mono/pull/5848
Comment 3 Ankit Jain 2017-10-24 15:45:31 UTC
Merged to master.