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

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


Attachments

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

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

Class1.cs:
> using System;
>
> namespace Repro {
>     public class Class1 {
>     }
> }

> $ msbuild repro.proj /t:BuildMe
> Microsoft (R) Build Engine version 15.4.0.0 (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.

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.