简体   繁体   中英

Are standard .Net 2 dlls compatible with the silverlight 2.0 runtime?

如果我避免引用silverlight 2.0运行时中不存在的程序集,那么我使用VS2008创建的.Net 2.0库dll是否可以使用silverlight 而无需重新编译或进行其他更改?

No, you will still need to recompile against the Silverlight versions of the assemblies. You can add these files to a Silverlight Class Library project "as link", sharing the same file between both projects so you at least won't have to worry about getting out of sync.

In addition to creating the files in one project and adding them as links in the other, you might still encounter API difference between the desktop and Silverlight APIs. You can work around those code differences with #if blocks, ie

#if SILVERLIGHT
/* some code */
#else // WPF
/* some other code */
#endif

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM