Convert a .NET 2.0 Project to a SilverLight library project
Last post 06-05-2008 7:51 PM by Neil Mosafi. 4 replies.
Sort Posts:
05-29-2008 10:19 AM
Convert a .NET 2.0 Project to a SilverLight library project

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
 

phobos7

Loading...
Joined on 04-20-2007
Edinburgh
Posts 2
06-02-2008 6:42 AM
Re: Convert a .NET 2.0 Project to a SilverLight library project

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.

shanaolanxing - This posting is provided "AS IS" with no warranties, and confers no rights.

Yi-Lun Luo - MSFT

Loading...
Joined on 10-29-2007
Posts 2,406
06-02-2008 7:08 AM
Re: Convert a .NET 2.0 Project to a SilverLight library project

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.
 

phobos7

Loading...
Joined on 04-20-2007
Edinburgh
Posts 2
06-02-2008 7:43 AM
Marked as Answer
Re: Re: Convert a .NET 2.0 Project to a SilverLight library project

You can share code, but not assembly. See http://silverlight.net/forums/p/16573/55296.aspx#55296 for more information.

shanaolanxing - This posting is provided "AS IS" with no warranties, and confers no rights.

Yi-Lun Luo - MSFT

Loading...
Joined on 10-29-2007
Posts 2,406
06-05-2008 7:51 PM
Re: Re: Convert a .NET 2.0 Project to a SilverLight library project

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 

http://neilmosafi.blogspot.com

Neil Mosafi

Loading...
Joined on 06-05-2008
Posts 1
Page view counter