开发者

compile cs files with mono?

I am trying to compile my project with mono on linux. My cmd looks something like...

gmcs  Pages/UserProfile.cs   Properties/Asse开发者_如何学运维mblyInfo.cs   queues.cs   watch_editor.cs Class1.cs -define:USE_SQLITE -r:System -r:System.Collections -r:System.Collections.Generic -r:System.Collections.ObjectModel -r:System.Collections.Specialized -r:System.Configuration

but much long. and i get the output

error CS0006: cannot find metadata file `System.Collections'
error CS0006: cannot find metadata file `System.Collections.Generic'
error CS0006: cannot find metadata file `System.Collections.ObjectModel'
...

How do i solve this?

I also tried it the other way around (below) and had the same error msg with .dll at the end of them

gmcs   -define:USE_SQLITE -r:System.dll -r:System.Collections.dll  -r:System.Web.UI.WebControls CommentCenter.cs   cookies.cs   db.cs   Default.aspx.cs 


You are confusing assemblies and namespaces. An assembly, such as System.dll, is a binary library file that can contain types in multiple namespaces. A namespace can be split across multiple assemblies, and the assembly name doesn't have to match the namespaces in any way.

-r is for referencing assemblies. You do not need to reference namespaces.

Given that most of the classes in those namespaces are in mscorlib (which is referenced by default) or System.dll, you probably just want

gmcs  Pages/UserProfile.cs   Properties/AssemblyInfo.cs   queues.cs   watch_editor.cs Class1.cs -define:USE_SQLITE -r:System

I strongly suggest you use an IDE such as MonoDevelop. You can view the compiler commands it generates, if you're interested.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜