Open madmiraal opened 4 years ago
I've removed the regression label, because #36361 means projects don't build in v3.2.1 using MSBuild (Mono) either.
We discourage using MSBuild (Mono)
for building projects on Windows. There are many issues with it. It's better to use MSBuild (VS Build Tools)
. With Godot 3.2.2 we also introduced the option to use the dotnet CLI.
That being said, let's try to determine if this is an issue with Godot or Mono's MSBuild. I'll test this when I have some time, but I'm quite busy with other tasks so I don't know when that will be possible. If you have time, these are the steps I would follow:
--verbose
).msbuild Path/To/Solution.sln
.& "C:\Program Files\Mono\bin\msbuild.bat" "C:/Users/Marcel/Downloads/Godot/Test Mono RC1/Test Mono RC1.sln" /v:normal /t:Restore,Build "/p:Configuration=Debug" "/l:GodotTools.BuildLogger.GodotBuildLogger,C:\Users\Marcel\Downloads\Godot\Godot_v3.2.2-rc1_mono_win64\GodotSharp\Tools\GodotTools.BuildLogger.dll;C:\Users\Marcel\AppData\Roaming/Godot/mono/build_logs\adeb49de002905ec5b4f1c77aaf06cf7_Debug" /p:GodotDefineConstants=\"GODOT_WINDOWS;GODOT_64;\"
Which produced the following output:
Microsoft (R) Build Engine version 16.5.0-ci for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1006: Property is not valid.
Switch: GODOT_64
For switch syntax, type "MSBuild -help"
& "C:\Program Files\Mono\bin\msbuild.bat" "C:/Users/Marcel/Downloads/Godot/Test Mono RC1/Test Mono RC1.sln"
Which produced the following output:
Microsoft (R) Build Engine version 16.5.0-ci for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 17/06/2020 14:07:56.
Project "C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.sln" (1) is building "C:\Users\Marcel\Downloads\Go
dot\Test Mono RC1\Test Mono RC1.csproj" (2) on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the i
nput files.
CoreCompile:
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:pr
ompt /warn:4 /define:GODOT;DEBUG;TOOLS /highentropyva+ /reference:"C:\Users\Marcel\Downloads\Godot\Test Mono RC1\.mon
o\assemblies\Debug\GodotSharp.dll" /reference:"C:\Users\Marcel\Downloads\Godot\Test Mono RC1\.mono\assemblies\Debug\G
odotSharpEditor.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\m
scorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Co
re.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.dll" /d
ebug+ /debug:portable /optimize- /out:".mono\temp\obj\Debug\Test Mono RC1.dll" /subsystemversion:6.00 /target:library
/utf8output /langversion:7.3 Node2D.cs Properties\AssemblyInfo.cs "C:\Users\Marcel\AppData\Local\Temp\.NETFramework,
Version=v4.7.AssemblyAttributes.cs"
Using shared compilation with compiler from directory: C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB6006: "csc.exe" ex
ited with code 1. [C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.csproj]
Done Building Project "C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.csproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.sln" (default target) (1) ->
"C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.csproj" (default target) (2) ->
(CoreCompile target) ->
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB6006: "csc.exe"
exited with code 1. [C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.84
Lines 59 of Microsoft.CSharp.Core.targets
is:
<Csc Condition="'%(_CoreCompileResourceInputs.WithCulture)' != 'true'"
& "C:\Program Files\Mono\bin\msbuild.bat" "C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.sln"
With the following minimal project:
MSBuildTest.zipWhich produced the following output
Microsoft (R) Build Engine version 16.5.0-ci for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 17/06/2020 14:50:41.
Project "C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|x86".
Project "C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.sln" (1) is building "C:\Users\Marcel\Downloads\Godot\
MSBuildTest\MSBuildTest.csproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Debug\".
Creating directory "\x86\Debug\".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the i
nput files.
CoreCompile:
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x86 /
errorreport:prompt /warn:4 /define:DEBUG /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Micr
osoft\Framework\.NETFramework\v4.7\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fr
amework\.NETFramework\v4.7\System.Core.dll" /debug+ /debug:full /optimize- /out:\x86\Debug\MSBuildTest.exe /subsystem
version:6.00 /target:exe /utf8output /langversion:7.3 HelloWorld.cs "C:\Users\Marcel\AppData\Local\Temp\.NETFramework
,Version=v4.7.AssemblyAttributes.cs"
Using shared compilation with compiler from directory: C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB6006: "csc.exe" ex
ited with code 1. [C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.csproj]
Done Building Project "C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.csproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.sln" (default target) (1) ->
"C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.csproj" (default target) (2) ->
(CoreCompile target) ->
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB6006: "csc.exe"
exited with code 1. [C:\Users\Marcel\Downloads\Godot\MSBuildTest\MSBuildTest.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.48
For the record, when using Visual Studio's MSBuild.exe, 1. produced the same error i.e. running:
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" "C:/Users/Marcel/Downloads/Godot/Test Mono RC1/Test Mono RC1.sln" /v:normal /t:Restore,Build "/p:Configuration=Debug" "/l:GodotTools.BuildLogger.GodotBuildLogger,C:\Users\Marcel\Downloads\Godot\Godot_v3.2.2-rc1_mono_win64\GodotSharp\Tools\GodotTools.BuildLogger.dll;C:\Users\Marcel\AppData\Roaming/Godot/mono/build_logs\adeb49de002905ec5b4f1c77aaf06cf7_Debug" /p:GodotDefineConstants=\"GODOT_WINDOWS;GODOT_64;\"
Produced the following output:
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework```
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1006: Property is not valid.
Switch: GODOT_64
For switch syntax, type "MSBuild -help"
However, both 2 and 3 both built fine.
In short there is a problem building projects from the command line.
GODOT_64
parameter.C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB6006: "csc.exe" exited with code 1.
even on non-Godot projects.Running Mono MSBuild with /v:diag includes the following additional information just before the error:
Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03
f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (TaskId:20)
So it looks like Mono MSBuild is looking for a system dependency that's not included in the targeted Framework. :-/
This is a known issue on Windows. As described here, Mono MSBuild is invoking csc.exe instead of Mono's csc.bat.
There is an open issue to fix it, but the workaround is to use the parameters: /p:CscToolPath="c:\Program Files\Mono\bin" /p:CscToolExe=csc.bat
to force it to use Mono's csc.bat.
Adding these parameters, both 2, and 3 now build fine with Mono MSBuild too.
The first one is related to this argument:
/p:GodotDefineConstants=\"GODOT_WINDOWS;GODOT_64;\"
Try removing the backslash \
before the double quotes.
If that still fails, remove the entire argument. I don't think it has any effect on this.
I just noticed this is 3.2.2rc1. In that case it may be related to calling restore like this: /t:Restore,Build
. I read that's bug prone and should use /restore
instead.
Try removing the backslash \ before the double quotes.
Running: & "C:\Program Files\Mono\bin\msbuild.bat" "C:/Users/Marcel/Downloads/Godot/Test Mono RC1/Test Mono RC1.sln" /v:normal /t:Restore,Build "/p:Configuration=Debug" "/l:GodotTools.BuildLogger.GodotBuildLogger,C:\Users\Marcel\Downloads\Godot\Godot_v3.2.2-rc1_mono_win64\GodotSharp\Tools\GodotTools.BuildLogger.dll;C:\Users\Marcel\AppData\Roaming/Godot/mono/build_logs\adeb49de002905ec5b4f1c77aaf06cf7_Debug" /p:GodotDefineConstants="GODOT_WINDOWS;GODOT_64;"
Produces a similar message:
MSBUILD : error MSB1005: Specify a property and its value.
Switch: /p:GodotDefineConstants=GODOT_WINDOWS;GODOT_64;
If that still fails, remove the entire argument.
Running: & "C:\Program Files\Mono\bin\msbuild.bat" "C:/Users/Marcel/Downloads/Godot/Test Mono RC1/Test Mono RC1.sln" /v:normal /t:Restore,Build "/p:Configuration=Debug" "/l:GodotTools.BuildLogger.GodotBuildLogger,C:\Users\Marcel\Downloads\Godot\Godot_v3.2.2-rc1_mono_win64\GodotSharp\Tools\GodotTools.BuildLogger.dll;C:\Users\Marcel\AppData\Roaming/Godot/mono/build_logs\adeb49de002905ec5b4f1c77aaf06cf7_Debug"
This seems to work, although it doesn't say success:
Build started 18/06/2020 11:58:38.
Project "C:\Users\Marcel\Downloads\Godot\Test Mono RC1\Test Mono RC1.sln" on node 1 (Restore;Build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
I assume this is because it doesn't try to recompile it.
I managed to reproduce this today. It seems Mono's MSBuild has issues with PackageReference. I will consider removing the option in 3.2.x and maybe 4.0 as well if the problem persists with the new project sdk.
Godot version: v3.2.2.rc1.mono.official
OS/device including version: Windows 10
Issue description: Cannot build any Mono Project with MSBuild (Mono). Projects build without a problem using MSBuild (VS Build Tools).
Steps to reproduce:
Minimal reproduction project: Test Mono RC1.zip
Console Output:
Build Log:
Possibly related to #36361.