我在使用Mono的Windows 10上构建解决方案时遇到了麻烦。
我开始尝试为正在开发的游戏构建整个解决方案。此解决方案在Mac上(使用Mono)可以很好地构建,但我们无法在Windows 10中运行它。
当我解决这个问题时,我已经将所有内容缩小到构建一个几乎为空的解决方案文件的地步,该文件引用了单个.CSProj
文件,该文件本身是空的,但是我仍然遇到错误。
这里是引导我进入现在的位置的步骤。
C:\Program Files\Mono\bin\msbuild.bat
我收到以下错误:
C:\ProgramFiles\Mono\lib\mono\msbuild\15.0\bin\Roslyn\Microsoft.CSharp.Core.target(52,5):
error MSB6006: "csc.exe"exited with code 1.
[C:\Users\bconley\workspace\test\TestProj\TestProj.csproj]
在msbuild.bat
的输出中,它告诉我当事情失败时它正在执行什么命令,所以我尝试自己运行它:
"C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Roslyn\csc.exe" /noconfig /nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Core.dll" /debug+ /debug:full /filealign:512 /optimize- /out:\Debug\TestProj.dll /subsystemversion:6.00 /target:library /utf8output Properties\AssemblyInfo.cs "C:\Users\bconley\AppData\Local\Temp\.NETFramework,Version=v4.7.1.AssemblyAttributes.cs"
该命令给出以下错误:
Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我完全迷住了。似乎我缺少一些基本的依赖性。我认为Mono在Windows上仍然可以使用吗?
最后找到了解决方案。他们只是不附带csc.exe附带System.Text.Encoding.CodePages.dll。将其从NuGet或Visual Studio中删除
Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn\
进入
Mono\lib\mono\msbuild\15.0\bin\Roslyn\