Skip to main content
Home Forums Silverlight Programming Visual Studio & Silverlight Development Tools Convert a .NET 2.0 Project to a SilverLight library project
5 replies. Latest Post by surielb on March 4, 2009.
(0)
phobos7
Member
2 points
7 Posts
05-29-2008 10:19 AM |
I'm looking into converting an existing .NET 2.0 project created with Visual Studio into a SilverLight library project. I want to make this an automatable task as we have a lot of code that we would prefer to share between the two projects in addition to avoiding the overhead of manually managing project contents. I've followed the steps outlined in a very useful post on converting a project to a SilverLight project by Neil Mosafi and with a few tweaks I have the project opening up in VS2008 (with SilverLight Beta 1 Development tools). However I still have a problem. I have two questions:
1) Is there any standard way of doing the .NET 2.0 to SilverLight Library project conversion?
2) During my attempted conversion process (I've written a small app which I'm happy to share) I update the "System" reference to "system" but VS2008 still thinks I'm trying to use "System.Uri" from "System". See the following error:
Error 56 The type 'System.Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. D:\Research\StreamLinkSilverlight\SilverlightApplication\Page.xaml.cs 27 13 SilverlightApplication
This suggests to me that the project is still referencing the full "System" namespace even though I've updated the project to reference the SilverLight reduced "system" one. Any ideas?
Thanks,
Phil Leggetter
Yi-Lun L...
All-Star
25052 points
2,747 Posts
06-02-2008 6:42 AM |
Hello, I think it's easier to update assembly references in Visual Studio than manually modifying the project file. Just remove a reference and add the Silverlight version.
06-02-2008 7:08 AM |
Yi-Lun Luo - MSFT:Hello, I think it's easier to update assembly references in Visual Studio than manually modifying the project file. Just remove a reference and add the Silverlight version.
I'm afraid that manually doing the referencing isn't a viable solution in the long term. As I mentioned in my post I'm looking for a way of sharing project contents between two projects. I was hoping that I could automatically convert a project file - maybe as part of a build step
Another solution would be to share files between the projects using source control. However, whenever a new file is added to the .NET 2.0 project it will also have to be manually added to the SilverLight project. I want to avoid this.
Is there any way of sharing an assembly between a .NET 2.0 project and a SilverLight project or can a SilverLight project only reference another SilverLight assembly? I really need a project that can be used by both SilverLight and a normal .NET 2.0 project.
06-02-2008 7:43 AM |
You can share code, but not assembly. See http://silverlight.net/forums/p/16573/55296.aspx#55296 for more information.
Neil Mosafi
1 Posts
06-05-2008 7:51 PM |
Can you try adding the following lines in the PropertyGroups for Debug and Release, and let me know how you get on?
<NoStdLib>true</NoStdLib> <NoConfig>true</NoConfig>
Thanks
Neil
surielb
8 points
5 Posts
03-04-2009 3:31 PM |
You can check out my article at the codeproject:
Converting .NET Assemblies to Silverlight Assemblieshttp://www.codeproject.com/KB/silverlight/SLAssemblies.aspx