HowTo Get Add View Recipe to work for existing sol

Topics: CAB & Smart Client Software Factory
Aug 5, 2006 at 11:37 AM
originally posted by: DamReev

My team has been an early adapter of CAB, and I have watched as you guys have switched from MVC to MVP as well as frequent WorkItem usage to hardly using workitems.
Of course being an early adopter means that you suffer when things get more refined. Anyway, we have a project in development that uses CAB and EntLib, which I would like to enable Guidance Packages for. I have been able to succesfully add the new Infrastructure.Interface, Infrastructure.Library, and Infrarstructure.Module projects generated by SCSF to our existing project (I copied the projects into our solution after executing the guidance package on a new solution. I've also add references to these projects to our existing modules. All recipes are available except the Create View recipe. What do I need to do either in terms of modifying the Guidance Package or less prefferrable modifying my project structure in order to make this recipe available?
Aug 6, 2006 at 11:57 PM
originally posted by: hmoeller

There must be some GUID set in place.

Original by unassal
"One final bit was missing. The .sln file contains a variable called "CommonProjectGuid". This guid must be set to the project guid of the Infrastructure.Interface project. Voila - AddView menu is back!"
Aug 8, 2006 at 4:08 AM
originally posted by: marianoszklanny

Hi!
The View recipe is not shown because the Recipe Framework makes some validations before enabling recipes for a solution item, and the validation may have failed for your projects.

What is validated for the View recipe is that your project actually contains references to:
- Microsoft.Practices.CompositeUI
- Microsoft.Practices.ObjectBuilder
- Infrastructure.Interface project

If you already have these references in your projects, as hmoeller said, you have to add the GUID of the Infrastructure.Interface project to the solution file. This GUID is required for the validation of the View recipe reference.

This is an example of the section you need to add to your solution file:

=====
GlobalSection(ExtensibilityGlobals) = postSolution
ShellProjectGuid = 91846577-869e-4ef9-a3df-323dcb8c28e3
CommonProjectGuid = e04cf524-676e-477b-8bde-615add9c88aa
RootNamespace = AdventureWorks
EndGlobalSection
=====

And this is the declaration of the Infrastructure.Interface and Shell projects. Note that the GUIDs equal the ones in the ExtensibilityGlobals section.

=====
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Interface", "Source\Infrastructure\Infrastructure.Interface\Infrastructure.Interface.csproj", "{E04CF524-676E-477B-8BDE-615ADD9C88AA}"
EndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shell", "Source\Infrastructure\Shell\Shell.csproj", "{91846577-869E-4EF9-A3DF-323DCB8C28E3}"
EndProject
=====

To see the code that contains the validation logic for the View recipe, see the file SmartClientDevelopment\References\ViewTemplateReference.cs in the Guidance Package source code. This file is the definition of the recipe reference that points to the View recipe.

You can check out the Guidance Automation Toolkit help to better understand how Visual Studio and the Recipe Framework interact to decide what recipes to show for a particular solution item.

Cheers,
Mariano Szklanny
http://staff.southworks.net/mariano
Aug 8, 2006 at 4:28 AM
originally posted by: marianoszklanny

I've written a post where I summarize how Visual Studio and the Recipe Framework work and interact with each other to decide what recipes have to be displayed in launch points.

"Why is a recipe enabled for a solution item and not for another one? How can I restrict the execution of a recipe to only a particular set of solution items? In this article, we will take a closer look at the Recipe Framework to answer these questions and also to understand what happens behind the scenes when you right-click an item in Solution Explorer."

Check it out at:
http://staff.southworks.net/blogs/mariano/archive/2006/08/06/691.aspx

Mariano Szklanny
http://staff.southworks.net/mariano