在我的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参考。
在此先感谢。
尝试在ILDASM中比较它们。 – SLaks 2011-03-15 15:38:27