Porting Mobile Client Software Factory to Visual Studio 2008

About six months, we posted on our p&p site that we would not be doing any further development on Mobile Client Software Factory. Since Visual Studio 2008 has shipped, I've been getting a bunch of questions around Mobile Client from customers who have committed to its use. Although our plans have not changed, we've had our sustained engineering team document the steps to upgrade the existing version in order to help those customers.

<Warning>What follows is not simple</Warning>

Installation

Problem #1

When you install Mobile Client Software Factory July 2006, an error occurs:

clip_image002[4]

Workaround

1. Download and install Orca MSI editor (which is distributed with the Windows SDK). The Orca MSI Editor is a table-editing tool that can be used to edit your .msi files. If you want to learn more about this tool, please visit this link.

Note: If you don’t want to download the Windows SDK, the Orca.msi tool is published here (Download it from this place at your own risk).

2. Open Orca MSI editor and then go to File -> Open... Select the MC-SF msi file (Mobile Client Software Factory July 2006 (refresh).msi).

3. Select the RegLocator table from the tables list.

clip_image003[4]

4. Modify the following key values (replace the 8.0 with 9.0 in the paths) from this table:

· GAXRegistry

· FindVSInstallDir

5. Save the changes.

6. Run the MSI file.

Problem #2

When the installer tries to build some solutions, an error occurs:

CaBGen.sln (or ObGen.sln, or OrientationAware.sln, or MobileClientFactory.sln) is from a previous version of Visual Studio and must be converted in order to build in this version of Visual Studio. To convert the solution, open the solution in this version of Visual Studio.”

clip_image005[4]

1. Open %Microsoft Mobile Client Software Factory Install Folder% \Tools\CabGen\CabGen.NoTests.sln in Visual Studio 2008.

a. Run the Conversion Wizard.

b. Copy the Microsoft.Cci.DLL in CabGen\Lib folder (This assembly is distributed with FxCop)

c. Compile the solution.

d. Compilation errors:

· “The name ‘Properties’ does not exist in the current context”

clip_image006[4]

Workaround

Replace ‘Properties’ text for ‘Microsoft.Practices.Mobile.CompositeUI.CodeGen.Properties’ .

2. Open %Microsoft Mobile Client Software Factory Install Folder% \Tools\ObGen\ObGen.NoTests.sln in Visual Studio 2008.

a. Run the Conversion Wizard.

b. Copy the Microsoft.Cci.DLL in ObGen\Lib folder (This assembly is distributed with FxCop)

c. Compile the solution.

d. No compilation errors.

e. Compilation warnings!

3. Open %Microsoft Mobile Client Software Factory Install Folder% \ApplicationBlocks\OrientationAware.NoTests.sln in Visual Studio 2008.

a. Run the Conversion Wizard.

b. Compile the solution.

c. No compilation errors.

d. No compilation warnings.


Guidance Package

a. Open %Microsoft Mobile Client Software Factory Install Folder% \GuidancePackage\MobileClientFactory.NoTests.sln in Visual Studio 2008.

b. Run the Conversion Wizard.

c. Compile the solution.

d. Compilation errors:

· “The type or namespace name 'Design' does not exist in the namespace 'Microsoft.VisualStudio.Shell'”

clip_image007[4]

Workaround

Install Visual Studio 2008 SDK (Microsoft.VisualStudio.Shell.Design assembly is included in this SDK, %Microsoft Visual Studio 2008 SDK Install Folder%\VisualStudioIntegration\Common\Assemblies).

Now, register the Guidance Package. (Without problems)

e. Compilation warnings!


Reference Implementation - AdventureWorksToGo

a. Open solution.

b. Run the Conversion Wizard.

c. Compile the solution.

d. Compilation errors:

· “System.IO.Stream.Dispose(bool)' is inaccessible due to its protection level”

clip_image008[4]

Workaround

                Two options:

· #1:

The .NET Compact Framework 2.0 does not support the Dispose method for the memory stream. You can comment out the few lines in GetTypedDataSetSchema method (from RI1OfflineDatastoreDataSet.Designer.cs file):

 finally
{
   if ((s1 != null))  {   //s1.Dispose();
  }
   if ((s2 != null))
  {
   //s2.Dispose();
  }
}

· #2:

Upgrade project to .NET Compact Framework 3.5.

Right click on AWToGoShell project and select Upgrade project… option.

clip_image009[4]

f. Compilation warnings!


Create a new Mobile Application / Create a Composite UI Module - Error

clip_image010[4]

Fig. 1 | ModuleLoaderService error.

Workaround

1. Make sure that the Composite UI Module builds to the same location as the Shell assembly.

2. Make sure that the Composite UI Module is set to deploy using the Configuration Manager on the Mobile CAB solution (see Fig. 1.1).

clip_image011[4]

Fig. 1.1 | Solution Configuration Manager.

Add Orientation Aware Control - Warning

Orientation Aware Controls seem to crash when trying to open them in the control design view:

at System.ComponentModel.TypeDescriptor.AddAttributes(Object instance, Attribute[] attributes)

at Microsoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponent component, Boolean rootDesigner)

at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)

at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)

at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)

at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)

at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.

IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)

at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)

at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)

at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.

TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

clip_image012[4]

Fig. 2 | Orientation Aware Control designer

Details

This is a known issue for all OAC editions (Professional, Community and MS P&P).

The Clarius Team is working on this problem. (Note: Mobile Client Software Factory includes an earlier version of the Orientation Aware Control developed by Clarius for Microsoft.)

In order to get updated information on this issue, you can see this thread.

Create Disconnected Service Agent – Error

When you try to create a Disconnected Service Agent from the recipe, an error occurs:

Microsoft.Practices.RecipeFramework.ValueProviderException: An exception occurred during the binding of reference or execution of recipe CreateDisconnectedServiceAgent. Error was: An error happened while calling the value provider or evaluating the default value of argument ProxyType..

You can remove the reference to this recipe through the Guidance Package Manager. ---> System.InvalidOperationException: Type MyShell.localhost.Service1 from file C:\Users\southy\Documents\Visual Studio 2008\Projects\MobileApplication15\Source\MyShell\Web References\localhost\Reference.cs has not been compiled yet. Recompile project and retry.

   at Microsoft.Practices.Mobile.SoftwareFactory.DteConverter.ToType(CodeClass codeClass) in C:\Program Files\Microsoft Mobile Client Software Factory\GuidancePackage\MobileClientFactory\DteConverter.cs:line 100

   at Microsoft.Practices.Mobile.SoftwareFactory.DteConverter.ToType(FileCodeModel codeModel) in C:\Program Files\Microsoft Mobile Client Software Factory\GuidancePackage\MobileClientFactory\DteConverter.cs:line 58

   at Microsoft.Practices.Mobile.SoftwareFactory.DteConverter.ToType(ProjectItem item) in C:\Program Files\Microsoft Mobile Client Software Factory\GuidancePackage\MobileClientFactory\DteConverter.cs:line 45

   at Microsoft.Practices.Mobile.SoftwareFactory.DisconnectedAgent.ProxyTypeValueProvider.OnBeginRecipe(Object currentValue, Object& newValue) in C:\Program Files\Microsoft Mobile Client Software Factory\GuidancePackage\MobileClientFactory\DisconnectedAgent\ProxyTypeValueProvider.cs:line 44

   at Microsoft.Practices.RecipeFramework.Recipe.CallProviders(IDictionary providers, IDictionaryService readonlyArguments, IDictionaryService arguments, Boolean isBefore)

   --- End of inner exception stack trace ---

   at Microsoft.Practices.RecipeFramework.Recipe.CallProviders(IDictionary providers, IDictionaryService readonlyArguments, IDictionaryService arguments, Boolean isBefore)

   at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)

   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)

   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)

   at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()

   at Microsoft.Practices.RecipeFramework.AssetReference.Execute()

   at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()

   at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

clip_image014[4]

Fig. 3 | Create Disconnected Service Agent – Recipe Error

Workaround

1. Build solution.

2. Close Visual Studio 2008.

3. Re-open solution.

4. Execute “Create Disconnected Service Agent” recipe.