tag:blogger.com,1999:blog-7085364525717171484.post6159527284660950492..comments2023-08-22T06:42:10.088-07:00Comments on .NET, Silverlight, Windows Azure, and other ramblings (from the UK): Silverlight and Code Reuse with non Silverlight applicationschrishayukhttp://www.blogger.com/profile/01255600685340367644noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7085364525717171484.post-49424047463352898122008-02-17T02:16:00.000-08:002008-02-17T02:16:00.000-08:00Thanks Daniel.This is the link to daniels article,...Thanks Daniel.<BR/><BR/>This is the <A HREF="http://msdn.microsoft.com/msdnmag/issues/07/07/ShareCode/default.aspx" REL="nofollow">link to daniels article</A>, it's a great little technique for code reuse (from the world of compact framework who already have these issues).<BR/><BR/>I understand what Daniel is saying and I like his techique and awful lot.<BR/><BR/>My only concern is that you still manually have to maintain two versions of the same assembly (although it is only linking code), it is still requires overhead, hence why i still think tool support is the real answer.<BR/><BR/>If you don't mind Daniel I would love folks to know about this technique as soon as possible, so i might extract the key parts of your article and give big links and quotes from it, so people have a method of reuse already.<BR/><BR/>I do however look forward to your Silverlight specific version.<BR/><BR/>Thanks for the workaround, Daniel most appreciated! However as I said I would still prefer to see proper support in Visual Studio for these scenarios.chrishayukhttps://www.blogger.com/profile/01255600685340367644noreply@blogger.comtag:blogger.com,1999:blog-7085364525717171484.post-16790953719245290822008-02-16T19:54:00.000-08:002008-02-16T19:54:00.000-08:00I would be very surprised if there was any clever ...I would be very surprised if there was any clever tool support for this when there was no clever tool support for the exact same issue between NETCF and full NetFx.<BR/><BR/>Manually setting up the two projects and reusing code files via conditional compilation is the answer. See my MSDN mag article that describes this for mobile<->desktop and apply the same principles for SL<->wpf.<BR/><BR/>I will write more about this in the mid-term (specifically in the context of SL 2.0)...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7085364525717171484.post-68294123591690185352008-02-16T12:46:00.000-08:002008-02-16T12:46:00.000-08:00Koen,I agree there are lots of other issues to con...Koen,<BR/><BR/>I agree there are lots of other issues to consider (especialy the ones you mention), however i think that through visual studio and the cross compatible project (which uses the virtual assembly reference), you could provide warnings/errors on compilation about usage of certain classes. So for example the Point struct, it would generate either an error or warning about the difference.<BR/><BR/>The second solution to this sort of problem is provide implementations that do match within the .NET Framework / Silverlight. For example Point could become Point2 and if you want to be cross compatible you should now use point 2.<BR/><BR/>I'm glad you like the Virtual Assembly suggestion, I am sure there are loads of other ideas to solve this problem, but I think it is important to highlight the issue as a lot of people are going to hit these very issues, very very soon.chrishayukhttps://www.blogger.com/profile/01255600685340367644noreply@blogger.comtag:blogger.com,1999:blog-7085364525717171484.post-57040266379205856542008-02-16T09:49:00.000-08:002008-02-16T09:49:00.000-08:00I like your Virtual Assembly suggestion, but there...I like your Virtual Assembly suggestion, but there are a lot of other issues to resolve;<BR/><BR/>* A class that exists in one platform and not in another. you probably want to solve this with compiler directives (#ifdef SILVERLIGHT, etc.)<BR/>* A nightmare; a class that behaves differently on two platforms. Take the Point struct for example. In .NET it's using integers for X and Y in Silverlight doubles are used.<BR/>* .. and more (i'm sure).<BR/><BR/>Code reuse among different .NET platforms is going to be debated a lot in the near future I reckon.<BR/><BR/>Koen<BR/>www.firstfloorsoftware.comUnknownhttps://www.blogger.com/profile/05434859237782889897noreply@blogger.com