SharpDevelop编译得很好,但是尝试通过booc进行编译并不起作用。
Boo Compiler version 0.9.4.9 (CLR 2.0.50727.8000)
Program.boo(4,8): BCE0021: Namespace 'Microsoft.Xna.Framework' not found, maybe
you forgot to add an assembly reference?
booc -resource:" C:\ test \" Program.boo,Windows cmd工具中使用的命令。
谢谢。阿利萨。
答案 0 :(得分:1)
Sharpdevelop很可能已经为您引用了库。这意味着,当您手动调用booc命令行编译器时,您必须告诉编译器MonoGame库的确切位置。我还没有能够检查自己,但我确实快速查看了命令行和Boo源代码,我认为你必须做以下事情:
-lib:C:/Path/To/MonoGame/Libraries
这将告诉编译器在哪里寻找其他库。 接下来你要做的就是添加你想要的库,例如:
-r:Microsoft.Xna.Framework.dll,Microsoft.Xna.Framework.Game.dll
将这两个额外的编译器选项添加到命令行中,我认为它应该可行。 我自己没有自己编译,因为我发现它相当乏味。相反,我决定在Boo中创建自己的构建脚本,以便编译我的Boo程序。这样我仍然需要添加库路径并引用库,如下面的代码片段所示:
def CompileEngine() as bool:
"""Compiles the engine and puts it in ./lib/SpectralEngine.dll"""
compiler = BooCompiler()
compiler.Parameters.Pipeline = CompileToFile()
compiler.Parameters.OutputType = CompilerOutputType.Library
compiler.Parameters.Ducky = true
compiler.Parameters.LibPaths.Add("./lib")
compiler.Parameters.OutputAssembly = "./lib/SpectralEngine.dll"
# Add libraries.
compiler.Parameters.References.Add(compiler.Parameters.LoadAssembly("OpenTK.dll"))
compiler.Parameters.References.Add(compiler.Parameters.LoadAssembly("NAudio.dll"))
compiler.Parameters.References.Add(compiler.Parameters.LoadAssembly("Boo.Lang.dll"))
compiler.Parameters.References.Add(compiler.Parameters.LoadAssembly("Boo.Lang.Parser.dll"))
compiler.Parameters.References.Add(compiler.Parameters.LoadAssembly("Boo.Lang.Compiler.dll"))
# Take all boo files from the Engine source directory.
files = (Directory.GetFiles(Directory.GetCurrentDirectory() + """/src/Engine""", "*.boo", SearchOption.AllDirectories)
.Where({file as string | return not file.Contains("Gwen")})) # Filter out old GWEN files.
for file in files:
print "Adding file: " + file
compiler.Parameters.Input.Add(FileInput(file))
print "Compiling to ./lib/SpectralEngine.dll"
context = compiler.Run()
if context.GeneratedAssembly is null:
print "Failed to compile:\n" + join(e for e in context.Errors, "\n")
return false
else:
return true