2011-03-15 64 views
0

在我的Windows Phone 7項目中,我嘗試將模塊中的源文件分開。Windows Phone 7:構建netmodule和dll

下面是我在做什麼:

"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe" /out:log.netmodule /t:module /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE /nostdlib /noconfig /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\mscorlib.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\system.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Net.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Windows.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Xml.dll"; CLog.cs 

然後我建立與netmodule輸入DLL:

"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe" /out:tools.dll /t:library /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE /nostdlib /noconfig /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\mscorlib.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\system.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Net.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Windows.dll";"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone\System.Xml.dll"; /addmodule:log.netmodule AssemblyInfo.cs 

但當

我從帶命令行的源建立一個netmodule添加我的dll 「tools.dll」 在我的Windows Phone 7個的參考,我得到這個錯誤:

Reference cannot be added [...] because it was not built using the windows phone runtime. windows phone project will work only with windows phone assemblies. 

我不明白這個錯誤,因爲我在建築的命令行只使用Windows Phone的引用。

一個有趣的信息:如果我不建netmodule,但DLL「log.dll」(第一個命令行),然後我可以在我的Windows Phone項目添加log.dll參考。

在此先感謝。

+0

嘗試在ILDASM中比較它們。 – SLaks 2011-03-15 15:38:27

回答

0

當你編譯你的netmodule,有一種錯誤的引用指向:

"C:\Program Files (x86)\Reference Adll"; 

同樣適用於第二DLL。嘗試先糾正一下。

+0

構建dll時,Visual Studio使用此引用。你爲什麼說這是不正確的? – TheFrancisOne 2011-03-15 17:06:14

+0

看看它 - 這不是一個實際的參考。這是一個拼寫錯誤的DLL路徑。 – 2011-03-15 17:14:50

+0

OK,它只是從我的複製/粘貼到我的訊息時發生錯誤。當我在我的電腦上執行此操作時,它是正確的參考。我仍然有這個問題 – TheFrancisOne 2011-03-16 14:08:26