1
我想用使用Microsoft.Build名稱的mono生成一個項目。在Mono項目中使用Microsoft程序集的問題
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
整個文件可用here。
不過,我得到這些錯誤:
$ mcs LoggerImpl.cs
LoggerImpl.cs(4,17): error CS0234: The type or namespace name `Build' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
LoggerImpl.cs(5,17): error CS0234: The type or namespace name `Build' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
LoggerImpl.cs(15,41): error CS0246: The type or namespace name `IEventSource' could not be found. Are you missing a using directive or an assembly reference?
LoggerImpl.cs(28,44): error CS0246: The type or namespace name `ProjectStartedEventArgs' could not be found. Are you missing a using directive or an assembly reference?
LoggerImpl.cs(36,43): error CS0246: The type or namespace name `BuildFinishedEventArgs' could not be found. Are you missing a using directive or an assembly reference?
LoggerImpl.cs(52,41): error CS0246: The type or namespace name `BuildErrorEventArgs' could not be found. Are you missing a using directive or an assembly reference?
LoggerImpl.cs(62,43): error CS0246: The type or namespace name `BuildWarningEventArgs' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 7 error(s), 0 warnings
同樣的,平滑肌細胞。這是奇怪的,因爲GACUTIL名單Microsoft.Build爲已安裝的組件:
$gacutil -l Microsoft.Build
The following assemblies are installed into the GAC:
Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Number of items = 1
即使Microsoft.Build.Framework(也使用)安裝:
$ gacutil -l Microsoft.Build.Framework
The following assemblies are installed into the GAC:
Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Number of items = 3
我在做什麼錯?
報價:你是缺少程序集引用? –
我認爲例如「Microsoft.Build.Framework」不在Mono下運行。請使用MoMA檢查所有程序集:http://www.mono-project.com/MoMA –