我试图用linux上的mono编译我的项目.我的cmd看起来像......
gmcs Pages/UserProfile.cs Properties/AssemblyInfo.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
Run Code Online (Sandbox Code Playgroud)
但很长.我得到了输出
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'
...
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我也尝试过相反的方式(下面),并在它们的末尾与.dll有相同的错误信息
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
Run Code Online (Sandbox Code Playgroud)
您会混淆程序集和命名空间.程序集(如System.dll)是一个二进制库文件,可以包含多个名称空间中的类型.命名空间可以跨多个程序集拆分,程序集名称不必以任何方式匹配命名空间.
-r用于引用程序集.您不需要引用名称空间.
鉴于这些命名空间中的大多数类都在mscorlib(默认情况下是引用)或System.dll中,您可能只是想要
gmcs Pages/UserProfile.cs Properties/AssemblyInfo.cs queues.cs watch_editor.cs Class1.cs -define:USE_SQLITE -r:System
Run Code Online (Sandbox Code Playgroud)
我强烈建议你使用像MonoDevelop这样的IDE.如果您感兴趣,可以查看它生成的编译器命令.
| 归档时间: |
|
| 查看次数: |
5795 次 |
| 最近记录: |