SCSF - April 2008 with Visual Studio 2008 Service Pack 1 Known Issues
Contents
Add View recipes are not displayed
The
Add View (with Presenter) and
Add WPF-View (with Presenter) recipes are not displayed in a
Visual Basic solution created with the SCSF – April 2008 in Visual Studio 2008 with
Service Pack 1 Beta.
Cause
The Guidance Package verifies if the project where the views will be added has the following references to enable the
Add View (with Presenter) and
Add WPF-View (with Presenter) recipes:
- Microsoft.Practices.CompositeUI assembly
- Microsoft.Practices.ObjectBuilder assembly
- Infrastructure.Interface project
The project templates used by the SC-SF have the
$RootNamespace$ variable as a prefix in the
AssemblyName project’s property.
<AssemblyName>$RootNamespace$.Infrastructure.Interface</AssemblyName>
It seems that in Visual Studio 2008
without SP1, the
Create Smart Client solution recipe ignores the $RootNamespace$ variable in the assembly name, therefore the assembly name is always set as
Infrastructure.Interface.
Using the SP1 in Visual Studio 2008, the $RootNamespace$ variable is replaced and the recipe does not find the dependency on the Infrastructure project because it is searching for an incorrect name.
Fix
To fix this issue, you need to modify the Guidance Package source code and register a custom one.
To fix Add View recipes are not displayed issue perform the following steps:
- 1. Open the GuidancePackage.sln solution.
- 2. In Solution Explorer, open the ViewTemplateReferenceVB.cs file located in the References folder of the SmartClientFactoryPackage project.
- 3. Find the following line in the file:
Line #154: if (reference.Identity == referenceIdentity) return true;
- 4. Replace the preceding line with the following one:
Line #154: if (reference.Name == referenceIdentity) return true;
- 5. Repeat steps 3 and 4 for the ViewTemplateReferenceCS.cs file located in the References folder of the SmartClientFactoryPackage project (Line 153).
New SC-SF solutions do not run
When you create a new SC-SF solution and run it (F5), the
DependentModuleLoaderService service throws a
ModuleLoadException exception when trying to load one of your modules.
Cause
All the projects generated with the Guidance Package have the
$RootNamespace$ variable as a prefix in the assembly name, so the
.dll files generated when you build the solution will also have the same prefix:
<AssemblyName>$RootNamespace$.Infrastructure.Module</AssemblyName>
However, in the
ProfileCatalog.xml file, the assemblies’ names do not include the
$RootNamespace$ prefix:
<ModuleInfo AssemblyFile="Infrastructure.Module.dll" />
Fix
To fix this issue, you need to modify the Guidance Package source code and register a custom one.
To fix New SC-SF solutions do not run issue perform the following steps:
- 1. In Solution Explorer, open the CreateSmartClientFactoryBusinessModuleCommon.xml file located in the Recipes\Common folder of the SmartClientFactoryPackage project.
- 2. Find the following line in the file:
Line #104: <Input Name="ModuleName" RecipeArgument="ModuleName"/>
- 3. Replace the preceding line with the following one:
Line #104: <Input Name="ModuleName" RecipeArgument="ModuleNamespace"/>
- 4. Repeat steps 2 and 3 for the CreateSmartClientFactoryFoundationalModuleCommon.xml file located in the Recipes\Common folder of the SmartClientFactoryPackage project (Line 106).
- 5. In Solution Explorer, open the ProfileCatalog.xml file located in the Templates\Solutions\Projects\Shell.Basic.CS folder of the SmartClientFactoryPackage project.
- 6. Find the following line in the file:
Line #4: <ModuleInfo AssemblyFile="Infrastructure.Module.dll" />
- 7. Replace the preceding line with the following one:
Line #4: <ModuleInfo AssemblyFile="$RootNamespace$.Infrastructure.Module.dll" />
- 8. Repeat steps 6 and 7 for the ProfileCatalog.xml file located in the Templates\Solutions\Projects\Shell.Basis.VB folder of the SmartClientFactoryPackage project.
- 9. In Solution Explorer, open the ProfileCatalog.xml file located in the Templates\Solutions\Projects\Shell.Extended.CS folder of the SmartClientFactoryPackage project.
- 10. Find the following lines in the file:
Line #4: <ModuleInfo AssemblyFile="Infrastructure.Layout.dll" />
Line #12: <ModuleInfo AssemblyFile="Infrastructure.Module.dll" />
- 11. Replace the preceding lines with the following ones:
Line #4: <ModuleInfo AssemblyFile="$RootNamespace$.Infrastructure.Layout.dll" />
Line #12: <ModuleInfo AssemblyFile="$RootNamespace$.Infrastructure.Module.dll" />
- 12 .Repeat steps 10 and 11 for the ProfileCatalog.xml file located in the Templates\Solutions\Projects\Shell.Extended.VB folder of the SmartClientFactoryPackage project.
- 13. Compile and Register the fixed Guidance Package.
Fix that works both with and without SP1 Beta
If you want to enable the GP to be used both with and without Service Pack 1, after performing the previous fixes you must do the one that follows:
- 1. Open the Smart Client Guidance Package Solution.
- 2. In the Actions folder create a new class named SetProjectAssemblyNameAction.cs.
- 3. Add the following code to the created class:
using EnvDTE;
using System;
using System.Collections.Generic;
using Microsoft.Practices.RecipeFramework;
using Microsoft.Practices.RecipeFramework.Library;
using Microsoft.Practices.RecipeFramework.Library.CodeModel;
using System.Globalization;
namespace Microsoft.Practices.SmartClientFactory.Actions
{
public class SetProjectAssemblyNameAction : ConfigurableAction
{
[Input(Required = true)]
public Project Project
{ get; set; }
[Input(Required = true)]
public string RootNamespace
{ get; set; }
public override void Execute()
{
Project.Properties.Item("AssemblyName").Value = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", RootNamespace, Project.Name);
}
public override void Undo()
{
throw new Exception("The method or operation is not implemented.");
}
}
}
- 4. Locate the SmartClientFactoryPackage project open the Recipes folder and open the file CreateSmartClientFactorySolutionCommon.xml located in the Common folder.
- 5. Add the following code in bottom of the ActionsAddReferences tag:
<!--Set the correct assembly names-->
<Action Name="SetInterfaceAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" RecipeArgument="InterfaceProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetLibraryAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" RecipeArgument="LibraryProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetModuleAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" RecipeArgument="ModuleProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetShellAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" ActionOutput="CreateShellProjects.ShellProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetLayoutAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage"
Condition="$(CreateShellLayoutModule)">
<Input Name="Project" ActionOutput="CreateShellProjects.LayoutProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
- 6. Add the following code to the CreateSmartClientFactoryFoundationalModuleCommon.xml inside the ActionsUpdateProfileCatalog tag at the buttom:
<!--Set the correct assembly names-->
<Action Name="SetFoundationalModuleAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.ModuleProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetFoundationalModuleInterfaceAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage"
Condition="$(CreateModuleInterfaceLibrary)">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.ModuleInterfaceProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetFoundationalModuleTestAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage"
Condition="$(CreateTestProject)">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.TestProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
- 7. Add the following code to the CreateSmartClientFactoryBusinessModuleCommon.xml inside the ActionsUpdateProfileCatalog tag at the buttom:
<!--Set the correct assembly names-->
<Action Name="SetBusinessModuleAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.ModuleProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetBusinessModuleInterfaceAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage"
Condition="$(CreateModuleInterfaceLibrary)">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.ModuleInterfaceProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
<Action Name="SetBusinessModuleTestAssemblyName" Type="Microsoft.Practices.SmartClientFactory.Actions.SetProjectAssemblyNameAction, Microsoft.Practices.SmartClientFactory.GuidancePackage"
Condition="$(CreateTestProject)">
<Input Name="Project" ActionOutput="UnfoldModuleProjects.TestProject" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace" />
</Action>
- 8. Open the folder CS located inside Recipes.
- 9. Add the following code to the buttom of the UnfoldModuleProjects action of the CreateSmartClientFactoryFoundationalModule.xml file:
<Output Name="ModuleProject"/>
<Output Name="ModuleInterfaceProject"/>
<Output Name="TestProject"/>
- 10. Open the folder VB located inside Recipes.
- 11. Add the following code to the buttom of the UnfoldModuleProjects action of the CreateSmartClientFactoryFoundationalModule.xml file:
<Output Name="ModuleProject"/>
<Output Name="ModuleInterfaceProject"/>
<Output Name="TestProject"/>
- 12. Compile and register the Guidance Package.