jeffkl/RoslynCodeTaskFactory

Compilation fails in latest Docker SDK image (Csc.dll was renamed all-lowercase)

takerukoushirou opened this issue · 3 comments

Using the latest Docker SDK image microsoft/dotnet:sdk with dotnet version 2.1.101, compilation fails with the following error:

/app/[...].tasks(140,9): error MSB6006: "Csc.exe" exited with code 1. [/app/[...].csproj]
/app/[...].tasks(140,9): error : The source file for this compilation can be found at: "/tmp/tmp7mDsMh.tmp" [/app/[...].csproj]
/app/[...].tasks(140,9): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "/root/.nuget/packages/roslyncodetaskfactory/1.2.6/build/netstandard1.5/RoslynCodeTaskFactory.dll". The task factory must return a value for the "TaskType" property. [/app/[...].csproj]

A deeper look at the detailed MSBuild log shows that the following command is being executed:

/usr/share/dotnet/dotnet  /noconfig /nostdlib+ /reference:[...]

i.e. the actual Csc assembly is missing after dotnet (only double spaces before first option).

It seems that the Csc.dll has been renamed to csc.dll (all lowercase), and Internal/ManagedCompiler.cs fails to resolve this as it only checks for Csc.dll. This could likely easily be fixed in the Csc resolver as setting a symbolic link from csc.dll to Csc.dll allows compilation to succeed.

Thanks for reporting this. I can change the code to look for a lowercase csc.

Please try v1.2.8: https://github.com/jeffkl/RoslynCodeTaskFactory/releases/tag/v1.2.8

If that didn't fix it, please re-open the issue.

@jeffkl thanks for the quick fix!

I just tested it in a local Docker image and I had no issues anymore.