Dave580275

I am creating a solution framework for building a WebSite application based-on our in-house created application architecture. My Guidance Package solution contains several templated projects and a WebSite. I'd like to include a Web Deployement Project in the solution, so that our developers may easily package the WebSite that they have developed with my Guidance Package. However, it would seem that Web Deployment Projects do not support the .vstemplate model. This makes it quite difficult to template.

I've taken a deeper look into the GAT Guidance Package itself to see if I could find the answer to my problem. Since the GAT is itself a Guidance Package, and it creates a Deployment Project for you when you invoke it, I thought the answers might be in there somewhere.

I have found that there are some Actions defined in the GAT Guidance Package that are used to create a setup project, but I'm having some trouble decifering what is actually going on. Here's a snippet of the Microsoft.Practices.RecipeFramework.MetaGuidancePackage.xml (which you can find in your GAT installation folder):

- <Action Name="CreateSetupProject" Type="Microsoft.Practices.RecipeFramework.MetaGuidancePackage.Actions.CreateSetupProjectAction, Microsoft.Practices.RecipeFramework.MetaGuidancePackage">
<Input Name="PackageName" RecipeArgument="PackageName" />
<Output Name="ProjectName" />
<Output Name="ProjectFolder" />
<Output Name="Template" />
</Action>
- <Action Name="GetInstallerProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.GetProjectAction, Microsoft.Practices.RecipeFramework.Library">
<Input Name="ProjectName" ActionOutput="CreateSetupProject.InstallerProjectName" />
<Output Name="Project" />
</Action>
- <Action Name="CreateProjectAction" Type="Microsoft.Practices.RecipeFramework.Library.Actions.CreateProjectAction, Microsoft.Practices.RecipeFramework.Library">
<Input Name="ProjectName" ActionOutput="CreateSetupProject.ProjectName" />
<Input Name="ProjectFolder" ActionOutput="CreateSetupProject.ProjectFolder" />
<Input Name="Template" ActionOutput="CreateSetupProject.Template" />
<Output Name="Project" />
</Action>
- <Action Name="SetPostBuildEvent" Type="Microsoft.Practices.RecipeFramework.MetaGuidancePackage.Actions.SetSetupPostBuildEventAction, Microsoft.Practices.RecipeFramework.MetaGuidancePackage">
<Input Name="SetupProject" ActionOutput="CreateProjectAction.Project" />
</Action>
- <Action Name="AddVSRegistrySearch" Type="Microsoft.Practices.RecipeFramework.Library.Actions.Vsd.AddRegistryLocatorAction, Microsoft.Practices.RecipeFramework.Library" LocatorName="VS" RegistryKey="SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS" Property="VS" Value="ProductDir">
<Input Name="SetupProject" ActionOutput="CreateProjectAction.Project" />
</Action>
The issues areThe issues are:
1. The CreateSetupProject action, apparently returns the name, folder, and template file path for the new Deployment Project based on the user-defined name for the package. These values are passed to the CreateProject action, which actually creates the Setup Project in the solution and returns a reference to it. What is the CreateSetupProject returning in the Template output parameter I've tried using the path to {VS2005}\Common7\Tools\Deployment\VsdProjects\WebSetup.vdproj....but not surprisingly this didn't work.
2. Something else that I don't understand is that the "GetInstallerProject action returns a reference to the Installer Project (which is templated in the GAT Guidance Package), but is taking as an input parameter CreateSetupProject.InstallerProjectName. Where is CreateSetupProject.InstallerProjectName comming from, since "InstallerProjectName" is not defined as an output parameter in the CreateSetupProject action
3. Finally, the CreateSetupProject action is defined as type "Microsoft.Practices.RecipeFramework.MetaGuidancePackage.Actions.CreateSetupProjectAction, Microsoft.Practices.RecipeFramework.MetaGuidancePackage". However, I can't actually see this action when I browse the Microsoft.Practices.RecipeFramework.MetaGuidancePackage assembly in the VS Object Explorer. Is there some kind of black magic going on here that does not make this action visible, yet it is still available to the GAT guidance package configuration file Wink
My hope is to create an action of my own called "CreateWebSetupProejct" and mimic the pattern in the GAT configuration file abve. However, if I can't figure-out what I need to return in the Template parameter, then I'm sunk Sad.
It's a shame that MS P&P created some many helpful actions for customizing Vsd projects (see the additional actions in the code snippet above), but not one for actually creating a deployment project itself.
Am I off my rocker
TIA,
Dave


Re: Visual Studio Guidance Automation Toolkit Including a Web Deployment Project Template in a Guidance Package Solution Template

faf38

Hi,
Try to install Software Factories Toolkit. There you can find solution template with installer project (you can choose between VS installer and Wix installer). If you have default installation folder this template should be:
C:\Program Files\Clarius Consulting\Software Factories Toolkit\1.0\MetaFactory\Templates\Solutions

The main solution template is: SoftwareFactorySolutionCSharp.vstemplate
This template references following projects:

Code Snippet

<ProjectCollection>
<ProjectTemplateLink ProjectName="$PackageName$Installer">
Projects\GuidancePackageInstallerCSharp\GuidancePackageInstaller.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$PackageName$">
Projects\GuidancePackageCSharp\GuidancePackage.vstemplate
</ProjectTemplateLink>
</ProjectCollection>



Here you have a project installer vs template:
Code Snippet

<TemplateData>
<Name>Package Installer Project</Name>
<Description>Project responsible for registering the package with the framework, used in the Setup project.</Description>
<Icon>GuidancePackageInstaller.ico</Icon>
<ProjectType>CSharp</ProjectType>
<SortOrder>20</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>ClassLibrary</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
</TemplateData>
<TemplateContent>
<Project File="GuidancePackageInstaller.csproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="true">InstallerClass.cs</ProjectItem>
</Project>
</TemplateContent>
<WizardExtension>
<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.60429.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate</FullClassName>
</WizardExtension>
<WizardData>
<Template xmlns="http://schemas.microsoft.com/pag/gax-template"
SchemaVersion="1.0">
</Template>
</WizardData>


Try this way.
HTH,
Regards,
Lukasz





Re: Visual Studio Guidance Automation Toolkit Including a Web Deployment Project Template in a Guidance Package Solution Template

Dave

Lukasz,

Thanks for the reply. I don't actually have an issue with adding and installer class project. The project I'm trying to add to my unfolded solution is a "Web Setup Project". That is, a project with the ".vdproj" extension, that would package a WebSite into an MSI installer.

My major issue is that since Deployment projects are not templated the same way as VS language projects, I'm not sure what path to supply to the Microsoft.Practices.RecipeFramework.Actions.CreateProjectAction template parameter.

The P&P guys have figured it out for a Setup Project (the GAT Guidance Package includes an action Microsoft.Practices.RecipeFramework.MetaGuidance.Actions.CreateSetupProjectAction which returns a template path as an output parameter. I'm just not sure what path to provide myself for a Web Setup Project template.

Is there anyone out there who can tell me what's going on in the CreateWebSetupAction so that I can replicate the functionality for a Web Setup Project

TIA,

Dave





Re: Visual Studio Guidance Automation Toolkit Including a Web Deployment Project Template in a Guidance Package Solution Template

Dave

Okay, I've figured out what I need to do to create the Web Setup Project.

1. In my CreateWebSetupCustomAction I set an string output property called "Template" with the following (abbreviated) code:

this.template = string.Format("{0Tongue Tied}WebSetup.vdproj", sln.get_TemplatePath("{54435603-DBB4-11D2-8724-00A0C9A8B90C}")); //GUID is the VS project type for Setup Proejcts.

2. I then pass this value as an ActionOutput to the CreateProjectAction action provided in the GAT (along with the other requried parameters).

This seems to work just fine. It appears that the CreateProjectAction can be used to create projects of just about any type, not just .vstemplate files.

I now have one problem with my Web Setup Project left. I need to include some GAC assemblies to the project after it is created. Does anyone know how to:

A) Add a "Special Folder" to the File System of a Setup Project The AddFolderAction in the Microsoft.Practices.Library.Actions.Vsd naemspace does not appear to support "Special Folders", only "Custom Folders". I get an exception when I try to add a folder "Global Assembly Cache Folder", presumably because this name is reserved for as a Special Folder.

B) Add a file from the Global Assembly Chache to the GAC Folder in a Setup Project Similar to A) the AddFileAction appears to only support addinf files from the file system, and not from the GAC. I tried passing the strong name of an assembly in the GAC, but when I ran the recipe, my VS environment totally barfed...crashing completely.

Any help is much appreciated.

Dave





Re: Visual Studio Guidance Automation Toolkit Including a Web Deployment Project Template in a Guidance Package Solution Template

Jose Escrich

Hi Dave,

Did you tried post your question in the Vs Extensibility forum If not, try to post your question there.

http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=57&SiteID=1