VS2010: Project Linker - sharing single code base between Silverlight, WPF and WP7 applications

by 12. September 2010 12:25

This blog (and webcast) will show you how you can download, install and use the Project Linker within a few minutes.  Unfortunately it took me a few hours to figure it all out.

I had downloaded the source code for the Project Linker for Visual Studio 2010 from this link and was dismayed to see it was not going to be a plug and play.  The site only provided the source code and  this turned into a real head-banger because much was assumed on my part; I had no idea how to configure a VSIX definition so that I could deploy it.   I was going to be forced to learn more than I had time for but the return on investment was going to be there.  I had used the Project Linker for 2008 and it saved countless time in multi-targeted applications (within the context of WPF, WP7 and Silverlight).  

After spending (unneeded) time learning about VSIX files I stumbled upon a blog that noted that the Project Linker was available in the extension manager - I kept my fingers crossed and sure enough it was in there.   I was very glad to see it in there despite the fact I had spent numerous hours banging my head on the topic - hopefully you caught this blog early in the game ;)

The steps follow for Visual Studio 2010:

  1. Click on Tools
  2. Click on Extension Manager
  3. Click on "Online Gallery"
  4. Search for "Linker" (top right textbox)
  5. Click on the [download] button on "Project Linker"
  6. Click [Install] when prompted.
  7. System will restart VS2010
  8. Walla!  You have the project linker installed

The VS2008 Project Linker - sharing single code base between Silverlight and Desktop applications blog has the details (with Webcast) on the Project linker which hasn't really changed so the focus of this blog will be soley installation and use of the project linker.

Visual Studio 2010 - missing Use Case template

by 19. August 2010 11:32

When I attempted to create a Use Case diagram it was not available in the list (as shown below).   I found the following link instrumental to restoring this template.  I dropped to Visual Studio Command prompt and executed devenv /installvstemplates and waited (patience is required).  After it completed I had my template!  

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

Excerpt from the above link follows:

Available templates may vary according to Visual Studio version, SKU, installation options, and other customizations. If you are missing a template that comes with your installation, run devenv.exe with the /installvstemplates switch. For more information, see How to: Restore Default Project Templates.

VS2010 RC - Unit Testing Azure Create, Read, Update and Delete (CRUD)

by 27. February 2010 04:26

I did some head-banging this morning while writing a unit test for Azure table storage CRUD operations.   My WebRole application uses the PersonDataSource (line 8) as an ObjectDataSource and works without issue so I was perplexed as to why my unit test kept crashing on line 40.   The UpdateItem(testdata) was successfully executing but the value was not being updated to "TestOrganization" as expected.

    1 /// <summary>

    2 /// Determines whether this instance can create read update delete

    3 /// azure table records.

    4 /// </summary>

    5 [TestMethod]

    6 public void CanCreateReadUpdateDeleteAzureTableRecords()

    7 {

    8     PersonDataSource mockData = new PersonDataSource();

    9     EHRPerson testData = null;

   10 

   11     string uniqueId = Guid.NewGuid().ToString();

   12 

   13     //:::::[ CREATE ]:::::::

   14     bool isSuccessful = mockData.CreateItem(new EHRPerson

   15     {

   16         ID = uniqueId,

   17         Name = "EHRTest",

   18         Organization = "EHROrganization",

   19         PersonType = "EHRPersonType",

   20         ProfessionalTraining = "EHRProfessionalTraining"

   21     });

   22     Assert.IsTrue(isSuccessful);

   23 

   24     //:::::[ READ ]:::::::

   25     testData = new List<EHRPerson>(mockData.Read())

   26         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   27 

   28     Assert.IsNotNull(testData);

   29     Assert.AreEqual("EHRTest", testData.Name);

   30     Assert.AreEqual("EHROrganization", testData.Organization);

   31     Assert.AreEqual("EHRPersonType", testData.PersonType);

   32     Assert.AreEqual("EHRProfessionalTraining", testData.ProfessionalTraining);

   33 

   34     //:::::[ UPDATE ]:::::::

   35     testData.Organization = "TestOrganization";

   36 

   37     mockData.UpdateItem(testData);

   38     testData = new List<EHRPerson>(mockData.Read())

   39         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   40     Assert.AreEqual("TestOrganization", testData.Organization);

   41 

   42     //:::::[ DELETE ]:::::::

   43     mockData.DeleteItem(testData);

   44 

   45     testData = new List<EHRPerson>(mockData.Read())

   46         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   47     Assert.IsNull(testData);

   48 

   49 }

What I found was that my item (TItem) parameter was being reset to default items on line 330 (image below) effectively overwriting my changes with original values.    However, if I ran my Cloud application it successfully updated the data (PersonDataSource as ObjectDataSource).   

I discovered that I was being returned the reference of the item that was read previously (line 25 above) which meant I was passing around a reference so line 330 below effectively replaced it with the original contents thus entry = item.  This wasn't a problem with the ObjectDataSource because I trust that ASP.NET creates a new instance and populates it with form values prior to sending it to the ObjectDataSource.

I resolved the issue by updating my TableServiceEntity base class to implement ICloneable so that I don't have to manage it at higher levels.    All of my table entities, i.e., EHRPerson will be POCO so this should work well.  

 

 

Serialize / Deserialize POCO objects - Silverlight and WPF (multi-targeting code)

by 17. November 2009 21:28

In our SDMS application (source code here) we have a library that is multi-targeting (shared codebase) for ASP.NET MVC2, Silverlight and WPF, as you'll see in the image below the "only" differences will be the App.xaml and Mainxxxx.xaml files.   To pull this off we give the CAG Bootstrapper a little more work to do.

One of the jobs of the GetModuleCatalog() method in the Bootstrapper is to deserialize our parameter object (more on parameter object in my next blog).   We have to do this in GetModuleCatalog because it is called within the UnityBootstrapper's CreateContainer command which occurs prior to CreateShell (see sequence diagram here).  Note that we do this with the object extension DeserializeObject

The following code will permit us to serialize and deserialize our POCO object.   The code resides in this applications UnityContrib project in the Extensions\ObjectExtension class.

 

Migrating Health Common User Interface from VS2008 to VS2010

by 11. November 2009 12:32

Initial efforts to convert/migrate the Microsoft Health Common User Interface from VS2008 to VS2010 failed miserably.   There were so many errors it wasn't real apparent where to start (after a few hours I gave up).  

After having converted a number of other programs I found there are a few consistent problems that once resolved move things along nicely.   They revolve around "Treat warnings as errors", Code Analysis and missing references.  If one of these occurs on an assembly that multiple projects have references to the error rate is compounded (making it harder to find).

After make the following few changes I found the Health Common User Interface compiles under VS2010:

Microsoft.Cui.SamplePages --- Add reference to System.Net

Microsoft.Cui.SampleWinForm --- Select None for "Treat warning as errors"

 

Uncheck "Enable Code Analysis on Build" for the following files:

  • Microsoft.Cui.ShowcaseControls
  • Microsoft.Cui.SamplePages
  • Microsoft.Cui.Roadmap
  • Microsoft.Cui.IsvDataProvider
  • Microsoft.Cui.Data
  • Microsoft.Cui.Controls

You'll want to remove the following three Unit Test

  • NhsCui.Toolkit.Test
  • NhsCui.Toolkit.Web.Test
  • NhsCui.Toolkit.WinForms.Test

If you don't you'll be prompted to convert the solution each time you load it as it will attempt to convert these and will fail.

Once the steps are complied with you can compile successfully!

VS2010 - The ServicePointManager does not support proxies with the https scheme

by 18. June 2009 06:16

I created a Codeplex project for a Visual Studio 2010 solution and was greated with the error "The ServicePointManager does not support proxies with the https scheme".

When you Google for "VS2010 Codeplex" you will find the following link at the top of the list:

http://coolthingoftheday.blogspot.com/2009/05/have-vs2010-beta-1-trying-to-connect-to.html

Where I was very happy to find a solution I was disappointed that it was only partial; it didn't provide the actual registry entries.  I found a blog that actually provided the registry settings and was disappointed when it didn't work.  

So I continued my search and was glad to find the following blog because it actually provided the commands necessary to automatically add the required registry entry.   It seemed to match what I did manually so I trust I made a typo somewhere.

The following link fixes it:

http://blogs.msdn.com/ablock/archive/2009/05/20/for-tfs-2010-beta-1-resolving-tf31001-the-servicepointmanager-does-not-support-proxies-with-the-https-scheme.aspx

I deleted my entries and ran the above commands for a 64bit environment and "walla!" I was able to connect to my codeplex project using VS2010!

For you 64bit folks the following batch file may save you a few steps

tfsFix.bat (267.00 bytes)

Note: In case their site is down at the time you need it I provide an excerpt (important stuff) from the above link:

If you are receiving the TF31001 error, you should be able to resolve this issue by running the following commands:

On all machine:

reg add hklm\SOFTWARE\Microsoft\VisualStudio\10.0\TeamFoundation\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False

reg add hklm\SOFTWARE\Microsoft\TeamFoundationServer\10.0\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False

 

Additionally on a 64-bit machine:
reg add hklm\SOFTWARE\Wow6432Node\Microsoft\TeamFoundationServer\10.0\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False
reg add hklm\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\TeamFoundation\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False
  --Aaron

 

Visual Studio 2010 and .NET Framework 4.0 CTP

by 7. December 2008 02:58

Link follows for the CTP download:
http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&displaylang=en

Be sure to review System Requirements - I was forced to purchase a new computer (requires 2 gig and dual-core processor).  An excerpt from the above link follows:

For more information on Visual Studio 2010 and the .NET Framework 4.0 visit http://msdn.microsoft.com/en-us/vs2008/products/cc948977.aspx

This CTP release is available in English only as a Virtual PC image. To download Virtual PC 2007 please visit http://www.microsoft.com/downloads/details.aspx?FamilyId=28C97D22-6EB8-4A09-A7F7-F6C7A1F000B5&displaylang=en
The CTP is designed to enable users to experience Visual Studio 2010 and the .NET Framework 4.0, and to provide feature design feedback on a limited set of features. These features are exposed through a set of walkthroughs that are included in the VPC itself. Many common development scenarios may not work in this CTP as it is designed to support the above walkthroughs.

 Top of page

System Requirements

  • Supported Operating Systems: Windows Server 2003; Windows Server 2008; Windows Vista; Windows XP
  • Minimum 75 GB available HDD space
  • The host computer must have a minimum of 2 GB RAM, with 1 GB allocated to the host operating system and 1 GB allocated to the VPC.
  • We recommend that the host computer CPU be at least a Core Duo 2 GHz processor.
  • Service Pack 1 of Microsoft Virtual PC 2007 is required to access the VPC.

To upgrade Microsoft Virtual PC 2007 to Service Pack 1, download and install the update from: http://www.microsoft.com/downloads/details.aspx?FamilyID=28c97d22-6eb8-4a09-a7f7-f6c7a1f000b5&DisplayLang=en

If the host computer has more than 2 GB RAM, you can increase performance of your VPC by allocating more memory to the VPC. After that change to the VM settings, you will need to update the page file inside the guest OS to be 1.5 times the amount of RAM you’ve allocated.

Notice

Blog videos and references to CodePlex projects are no longer valid