开发者

CLR differences between Silverlight and normal .NET Framework?

开发者 https://www.devze.com 2023-01-09 17:01 出处:网络
Are there any aggregated guides to writing libr开发者_开发知识库aries which need to be Silverlight-compatible?

Are there any aggregated guides to writing libr开发者_开发知识库aries which need to be Silverlight-compatible?

Or is the standard procedure to just build, look for errors, fix, repeat?

Obviously I recognize the answer may depend on what version of Silverlight is being targeted, but I'd expect any answer to just specify version if the solution is specific.


Clarification: Basically I want the library to work for both plain-old CLR and Silverlight and not reference any Silverlight specific libs. If it needs to reference such libs in order for it to work in Silverlight, then I'd prefer use conditional compilation and produce a specialized build. Ideally it would just work as I could pick a subset of functionality of the two.


Are there any definitive resources for this? I'm mostly looking for a website which lists common things to watch out for. Basically proactive rather than just looking for issues after an approach is taken.


Do you mean to share code between a Silverlight project and a regular CLR project? In that case I usually write the code as a Silverlight project to make sure I don't use any features not available there. As long as you stay away from the Gui components your code will be compatible with .Net as well.

It is possible to reference Silverlight 4 assemblies from the .Net 4 runtime. Here you have the same situation, but you only need to compile one version of your assembly.


Starting a community wiki for links to resources on this topic. (Still searching for a list of API delta between standard CLRs and Silverlight CLRs.)

Targeting multiple CLRs with the same code:

Silverlight fully runs on a different version of the CLR which is binary incompatible with the standard CLR. So you literally cannot build a library which targets both. However, you can use the exact same code files for both built targeting each environment.

  • http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight

(Alternatively you can do the same thing a single .csproj if you are careful with your conditional attributes.)

Differences Between WPF and Silverlight 2.0:

  • http://msdn.microsoft.com/en-us/library/ff648673.aspx

Differences Between WPF and Silverlight 1.1:

  • http://wpfslguidance.codeplex.com/

Silverlight Differences on Windows and Macintosh:

  • http://msdn.microsoft.com/en-us/library/cc838247.aspx

Differences in Silverlight on Windows Phone:

Yet another variation is the Windows Phone implementation of Silverlight.

  • http://msdn.microsoft.com/en-us/library/ff426930.aspx
0

精彩评论

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