Dave580275

I'm currently developing a Guidance Package that can be used to develop an application based-on my Company's custom framework. This, of course, includes several pre-complied component assemblies. I am having difficulty determining the best way to include these assemblies in my Guidance Package (or along-side the Guidance Package installation), and then reference them in the unfolded template.

I've tried these approaches, but ran in to trouble with each:

1. Add the component assemblies to the GAC, and then reference them in the template projects. After adding the assemblies to the GAC, I was unable to see them when I tried "Project->Add Reference..." I do not see my component assemblies under the ".Net" tab (which I thought was a list of GAC-installed assemblies).

2. I've also considered adding the assemblies to my solution structure as such:

MySolution\Lib\Component1.dll

MySolution\Lib\Component2.dll

which could then be referenced by relative path by:

MySolution\Project1

MySolution\Project2

MySolution\WebSite

However, I could not figure-out how to package the assemblies with my Guidance Package such that the Lib folder would be created with the component assemblies when the solution is unfolded.

To generalize, I need some help on the best-practice for deploying common assemblies with the guidance package, and then referencing them in my solution projects/website when the solution unfolds.

Any help is very much appreciated!

TIA

Dave



Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Jose Escrich

Hi Dave,

You should manage your legacy assemblies just adding those using the Add References, if those assemblies are not in the GAC you also set the Copy Output as True in order to get the assemblies in the package bin folder. Gax tries to find the assembleis in the private bin folder and in the PublicAssemblies Vs folder.

Regarding your assemblies in the GAC, in order to get that in the Add Reference dialog, you should add a registry entry as the follow:

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies]@="C:\\MyAssemblies"

or you can add the same entry at Local Machine if you want to add for all user.

hope it helps.

Jose.






Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Dave

Jose,

Thanks for the reply.

That helps a bit. I think I've actually got a handle on how to add the references to my assemblies, the remaining issue would be a best-practice on deploying them to the target developer machine.

First, it is worthwhile noting that these are NOT "legacy" assemblies. Rather, they are precompiled .Net 2.0 assemblies that provide sevearl components that are reference by templates in the application architecture guidance package I am developing.

In terms of a best-practice, is it better to:

A. Install these infrastructure assemblies in the GAC. This is easy enough to accomplish in my Guidance Package Setup project.

or

B. When the solution in my Guidance Package unfolds, include a Lib folder and add a file reference to each of my projects. I'm not sure how to deploy achive the deployment of the assemblies into my solution structure when the template unfoluds because these assemblies are not items in a specific project. The sturcture would be something like:

MySolution\Lib\Assembly1.dll

MySolution\Lib\Assembly2.dll

MySolution\Project1\

MySolution\Project2\

MySolution\WebSite\

Thanks Jose (and anyone else with best-practice suggestions/guidance)

Dave





Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Dave

I've attempted implementing the GAC-based solution I described in my last post, but there is one problem that I run into. It would seem that there is no way to have a GAC reference "CopyToLocal" in the WebSite bin folder, as is possible within other VS language project types.

This causes a business problem for our end-users as it wil require that the common referenced assemblies be installed into the GAC on the server before the WebSite can be deployed. We would like our WebSite to be entirely self-contained, such that there are no server prerquisites beyond that of any .Net 2.0 WebSite, and sitll have the ability to use xcopy deployment.

This makes me think that solution B is perhaps a better one. I'm considering including these common assemblies as embeded resources in my Guidance Package assembly. I could then create an Action that would read them out into a "Lib" folder under my solution after the template unfolds, and then all the solution projects and the WebSite could reference them by using a file reference to a relative path.

Any suggestions or comments on my analysis and approach would be greatly appreciated!!

TIA

Dave





Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Jose Escrich

Hi Dave,

What you could do is make an installer for your common assemblies an install it in the some common files folder, like C:\Program Files\Common Files\YourCompany also you can add a registry entry in order to have those assemblies available in the Add Reference dialog.

Regarding your guidance package, when you unfold a solution you can assume that you already have installed the common assemblies library and make a reference to that. Maybe you can get the location of that assemblies using a registry entry, which have the installation path.

jose.






Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Dave

Jose,

Thanks for the reply! We've actually already considered a common library installation path that installs our custom assemblies with the guidance package. Unfortunately, this does not meet one of our business requirements, that being, once a solution is created in needs to be portable from one development machine to another. Since the install path is not guaranteed to be the same accross all machines, references to this absolute path could potentially break.

After some debate, we have tentatively arrived at the unanimous decision that common libraries should be treated as such, and therefore live in the GAC after all. This does box us in to an MSI-based deployment of applications because this approach does not support xcopy, but it would appear to be a good practice. We will therefore deploy our common libraries to the GAC with the installation of the Guidance Package. The template in the Guidance Packge wil in-turn include a templated MSI that will install the application WebSite and the requried GAC references onto the target server.

I have three related questions along these lines:

1. How do you include an MSI in a Guidance Pacakge It is obviously possible, as the GAT is itself a Guidance Package which includes a templated MSI, which furthermore gets customized (apparently via recipe) when the GAT Gudance Package is invoked/unfolded.

2. Is the registry key, which you mentioned previously, the only way to make GAC assemblies visible to the Add References dialog in VS2005 Also, as multiple version of the same assembly can live in the GAC, is a separate entry require for each version set that we want visible in VS2005 If so, how do we determine which version we're actually adding from the Add References dialog

3. How can we version our Guidance Package As this is an application framework, there are bound to be subsequent releases, fixes, etc....Is it possible to have multiple versions of the same Guidance Package installed (to support backwards compatability) How would we properly version the Guidance Package to make this possible

TIA

Dave





Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Jose Escrich

Hi again,

1. You can include any file just copying it into the template structure and adding it in one of the .vstemplates, ie: if you want to have that .msi file in a folder of a certain project, what you should do is, add that .msi reference into the .vstemplate project. (remember set the copy local as true for all files in the templates folder). However if you want to add the .msi or any other file in a solution folder, you have to create an action after that's run after the unfolding which will create that solution folder, and copy the .msi file.

2. The Add reference dialog includes the version number for each assembly.

3. Usually it requires to uninstall and reinstall the package, you can also versioning the gp assembly.






Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Dave

Hi Jose,

1. I "mispoke" when I asked about including an MSI in guidance package. What I actually meant is that I want to include an template Web Setup project in my guidance package solution. The idea being that after the template unfolds, it will include a project for deploying the WebSite that is being developed w/ the guidance package. I didn't actually meant that I wanted to include a packaged MSI file in one of my projects. Since Web Seupt projects (.vdproj), aren't wuite the same as other VS Language projects, is it still possible to create a .vstemplate file that will allow me to template this project

2. D'oh....I didn't notice the scroll bars (how embarassing Smile ).

3. I suppose another way to ask this question is "How do I modify my guidance package so that it does not conflict with a previous version of the same package ". The idea here is that since my guidance package is for an application framework, it includes recipes and actions that are tied to a particular version of the framework and therefore the guidance package. So, for example, to ensure backwards compatability, I need version 1.0 and 1.5 of my Guidance Package to be installed side-by-side. To achieve this, what elements in the GP configuration do I need to modify E.g. do I change the GP's GUID I would also increment the version nuymber on my GP assembly. I also, assume that version 1.0 and 1.5 would need to have separate install paths.

Thanks for your help!

Dave





Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

Dave

Further to my previous post:

1. Basically, what I need to do is create an action similar to Microsoft.Practices.RecipeFramework.MetaGuidancePackage.Actions.CreateSetupProjectAction, but instead mine would be a "CreateWebSetupProjectAction". I esentially want to mimic the pattern used in the GAT guidance package configuration file (Microsoft.Patterns.RecipeFramework.MetaGuidance.xml) that creates a setup project and links-in the primaray ourtput from the WebSite project, and an templated Installer class project.

The major hrudle at the momemt is that I have no idea how to programatically create the Web Setup Project in an action. It going to start by creating and action with the same input/soutpus as the "CreateSetupProject"....and play around with the automation objects in the Execute() method. Hopefully, I can figure it out, but I do find it very easy to go down the wrong path in the VS automation model. Any suggestions would be greatly appreciated.

Regards,

Dave





Re: Visual Studio Guidance Automation Toolkit How do I include and reference a custom assembly in my Guidance Package?

vga

Hi Dave,

re: guidance package versioning -- there is no support for this there yet, so you would need to create a new guidance package (making sure you use a new GUID and NAME attribute in the <GuidancePackage> element) and install it into it's own folder. These would look like just two different and totally unrelated package to GAT.

In order to create an action that creates a Web Setup you should find out about the automation model for Web Setup projects, that is, if there is one at all and how you could automate it. This would be a good question for the Visual Studio Extensibility forum where VS Team members hang around. Once you have this information and you can test that it works you should then wrap it into a GAX action that you could easily reuse and reference from your "CreateSolution" recipe or similar.

If you don't have any luck in the VS Extensibility forum and you've any specific Web Setup project automation question I can try to route it internally to the proper guys.

HTH,

-Victor.