2011-03-15 67 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