Compiling 2009.2 samples’ source code with Visual Studio 2010

Atanas Dyulgerov / Friday, January 22, 2010

Dear reader,

Today’s topic will guide you through the process of converting the source of Infragistics Silverlight LoB 2009.2 samples in order to compile with VS2010. Unfortunately this is not exactly as straightforward a task as it might seem at first; however, if you follow this article step by step you should not have any problems.

First, I assume you already have a working installation of Visual Studio 2010 and Silverlight. Make sure you are able to compile and run basic Silverlight 3 projects with VS2010 before you proceed. Note that if you have updated VS from 2008 to 2010 on a 64bit machine, for example, there will be a number of VS-related bugs that you need to take care of.

Step 1 – Obtain the code you need:

Download “NetAdvantage for Web Client 2009 Vol. 2 - Silverlight Only“ from http://ko.infragistics.com/dotnet/netadvantage/silverlightdownloads.aspx You might need to register in order to do that. After you extract the downloaded archive install NetAdvantage_Silverlight_20092_Samples.exe

Step 2 – Convert the project with VS2010

Open SamplesBrowser.Samples.LOB.sln with Visual Studio 2010. The file is located in C:\Users\Public\Documents\Infragistics\NetAdvantage 2009.2\Silverlight\Samples\SamplesBrowser. This is the default location for the samples after they are installed.

When the solution loads you will be asked whether you want to convert it in VS2010 format. Hit Finish. Then you will be asked to convert the project to Silverlight 4. Press No. Silverlight 4 will be supported in our 2010.1 release.

Now that might take some time J.

Step 3 – Remove unnecessary files and services

The rest of the document gives you instructions on how to overcome the errors that will occur if you try to compile the solution at this point.

First remove the three service references in project SamplesBrowser.Shell.Common. They are ContentService, NavigationService and ResourcesService. This step is required because the ContentService does not exist in the solution, and the other two need their addresses updated to match your VS development server settings.

After you have the references removed we need to take out everything that is related to the ContentService. Start with all files with names that begin with Content in the ServiceLayer folder of the same project. Then delete the Content folders from ViewModel, Controls and Model folders. Remove HomePageViewModel.cs from ViewModel. All this is in the same SamplesBrowser.Shell.Common project.

All that is left from the ContentService now is the namespace reference in NavigationBroker.cs which is in the Utility folder of SamplesBrowser.Shell.Common and SampleControlViewModel.cs under ViewModel in SamplesBrowser.Samples.LOB. The line that has to be removed is:

using Infragistics.Samples.Silverlight.Shell.ContentService;

 

Step 4 – Recreate the services

The next step is to recreate the services with the correct addresses. In order for the changes we made so far to take effect and allow Visual Studio to regenerate the services properly you need to restart VS.

After you do that go to the SamplesBrowser.Shell.Common project, service reference and add new service reference. In the dialog that opens, press Discover and then select the navigation service. Call the namespace NavigationService and press OK. Do the same for ResourceService.

When you have done that, VS should have generated a new ServiceReferences.ClientConfiguration file.

Step 5 – Fix the resource files

 

This is the last and most tedious step. It is caused by Visual Studio badly regenerating all design files for the resx files. Go to Samples/Resources folder in SampleBrowser.Samples.LOB project. Edit all *.Designer.cs files (there are 20 of them). Each of those files has internal constructor. It must be public. Example: internal AveeStrings() {} should become public AveeStrings() {}

After you are finished with those resources there is just one left: ShellStrings.Designer.cs in the Resources folder of SamplesBrowser.Shell.Common project.

 

Note that *Designer.cs files are autogenerated and you need to expand the corresponding *.resx file to see it J. You might not see it at first glance.

 

Well, that is all you need to do. Just Rebuild the whole solution and start the SamplesBrowser.Web.LOB project. Everything should be OK J.

 

I hope this article was helpful to you. Any feedback or questions are welcome. Thank you!