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.

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