开发者

Windows Phone 7 : build netmodule and dll

开发者 https://www.devze.com 2023-02-17 10:59 出处:网络
In my Windows Phone 7 project, I try to separate my source files开发者_运维百科 in module. Here is what I am doing :

In my Windows Phone 7 project, I try to separate my source files开发者_运维百科 in module.

Here is what I am doing :

I build a netmodule from sources with command line :

"%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

Then I build a DLL with netmodule input :

"%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

But when I add my dll "tools.dll" in my windows phone 7 references, I get this error :

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

I don't understand this error, since I use only windows phone references in my building command lines.

An interesting information : if I don't build netmodule, but dll "log.dll" (1st command line), then I can add log.dll reference in my windows phone project.

Thanks in advance.


When you are compiling your netmodule, there is a wrong reference that points to:

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

Same applies to the second DLL. Try correcting that first.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号