Pablo Galiano :

Subscriptions

<October 2008>
SuMoTuWeThFrSa
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

News

Subscribe to Pablo Galiano by Email

Post Categories

Whidbey General (RSS)

Creating and deploying solution item templates

A solution item template is an VS item template that is available at the Solution level.

scn1

The list of item templates that you see on the Add New Item dialog is constructed by VS by looking for installed templates on certain locations.

There are two types of templates:

  • Installed Templates
    • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • Custom Templates 
    • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

scn5

The location for the custom templates can be modified:

scn4

So lets see again the locations:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

The problem is that for a solution item template we DON'T have a language, there is no project that act as a container because we want to add the item directly to the solution.

So how we can create and deploy a solution template? The answer is by using the General category:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\General\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\General\

And the same category for the ProjectType node in the vstemplate file:

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>Class1.cs</DefaultName>
    <Name>MyClass</Name>
    <Description>My Item Template</Description>
    <ProjectType>General</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>MyClass.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Class1.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

Pablo

posted Thursday, October 04, 2007 9:19 PM by pga with 1 Comments

Visual Studio 2005 (devenv.exe) switches

There is documentation available on MSDN about devenv.exe command line switches

When we work with Visual Studio Extensibility there are a couple of useful switches that we can also use:

http://msdn2.microsoft.com/en-us/library/bb166507(vs.80).aspx

But we also have:

  • devenv.exe /log <full path to log file>

This switch allows you to run Visual Studio and cause it to generate a log file of the various activities that it does behind the scenes.  This switch can be useful in debugging problems where the IDE crashes when you try to launch it or when you encounter package load failure error messages.

If you do not provide a path, Visual Studio 2005 will use by default the file %USERPROFILE%\Application Data\Microsoft\VisualStudio\8.0\activitylog.xml

  • devenv /rt

This switch is similar to /rootsuffix one, with the main difference that it allows you to specify the full registry root instead of the suffix.

Pablo

posted Thursday, May 10, 2007 10:08 AM by pga with 0 Comments

VSIPFactory released!!!

The M0 version of VSIPFactory was just released!

VSIPFactory - A Software Factory for Visual Studio Extensibility

M0 Features:

·         Recipe for creating a VS service

·         Recipe for creating a VS tool window

·         Recipe for creating a VS command

·         Recipe for configuring VSIP package

·         Recipe for configuring VSIP package PLK

·         Recipe for configuring VS splash/about screens

·         Recipe for registering/unregistering a VSIP package

 

You can download it from:

http://www.codeplex.com/vsipfactory/Release/ProjectReleases.aspx?ReleaseId=2829

Pablo

posted Tuesday, April 03, 2007 4:33 PM by pga with 1 Comments

VS SP1 Vista Update

The Visual Studio 2005 SP1 for Vista has been released for download.

Lets see how it works...

Pablo

posted Wednesday, March 07, 2007 5:49 AM by pga with 1 Comments

Persisting user information in Visual Studio

Visual Studio offers a way to persist user information between sessions. This is done by using the Globals object located on the EnvDTE assembly.
The Globals object allows you to store, retrieve, enumerate and persist user information. So the next time the IDE is open this information is restored.
We can persist information at three different levels:

  • VS or IDE
     
    The information is stored in C:\Documents and Settings\<username>\Application Data\Microsoft\Visual Studio\extglobal.dat. These values are persisted each time VS is closed or a Save All operation occurs.

Snippet:

            DTE.Globals["PropertyName"] = value;
            DTE.Globals.set_VariablePersists("PropertyName", true);

  • Solution

The information is stored in the .sln file. These values are persisted when the solution file is saved.

Snippet:

            solution.Globals["PropertyName"] = value;
            solution.Globals.set_VariablePersists("PropertyName", true);

  • Project

The information is stored in the project file. These values are persisted anytime a project is saved.

Snippet:

            project.Globals["PropertyName"] = value;
            project.Globals.set_VariablePersists("PropertyName", true);

One important thing is that Values to be stored must be strings, they cannot be objects or structures because these files are xml files.


Pablo

posted Tuesday, January 09, 2007 6:18 PM by pga with 1 Comments

What Happens When

I would like to start a new series of posts named What Happens When or WHW for now on.

Basically I will try to explain what happens behind the scenes when we do things inside VS and GAX. I think this is very helpful to understand the internal mechanics of VS and GAX and how things work.

So, the first post on this series is:

WHW we register a guidance package?

Answer:

  1. The guidance package project is compiled.
  2. The installer project is compiled and installed using installutil.
    1. An entry for the guidance package is added to the recipe framework manifest located at C:\Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework\RecipeFramework.xml.
      1. This entry contains a timestamp that is used by the runtime to check if a guidance package was altered before loading it.
    2. The following registry entries are created:
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AutoLoadPackages\<PackageGUID>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Menus\<PackageName>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\PseudoFolders\<PackageGUID>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\<PackageGUID>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\<LANGUAGE>\Paths\<PackageName>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\<PackageGUID>
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\<PackageGUID>
    3. A devenv / Setup is done to update menus and commandbars defined in the guidance package (this step requires some time to process).

 

Pablo

posted Tuesday, January 09, 2007 7:08 AM by pga with 1 Comments

VS Custom Tool file’s association

Kzu has an excellent post o how to create a custom tool. One thing that I want to add to that post is that there is a new feature of Visual Studio 2005 that allows us to associate a file extension to a custom tool.

This means that every time we add a new item to a solution with a particular extension the custom tool will be automatically associated with the item, instead of manually adding the association via the properties window.

 

Steps:

  • Open the window registry
  • Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Generators\<Language>

Where <Language> is:

{164b10b9-b200-11d0-8c61-00a0c91e29d5} for VBnet

{e6fdf8b0-f3d1-11d4-8576-0002a516ece8} for J#

{fae04ec1-301f-11d3-bf4b-00c04f79efbc} for C#

 

  • Define a new Key with extension to associate (you must prefix the extension with a “.”)

Example: “.foo”

 

  • Specify the data for the default value of that key to the name of the key of the custom tool

generator.jpg

When we add a New Item with the ".foo" extension Visual Studio automatically associates the custom tool with it.

generator2.jpg

 

Pablo

posted Friday, October 13, 2006 8:17 AM by pga with 0 Comments

Creating a VS2005 instance

Sometimes is very usefull for testing purposes to create a VS2005 instance, and them use that instance to have access to the DTE API stuff.

So, here is a code snippet to create a VS2005 instance and to open a solution:

            Type t = Type.GetTypeFromProgID("VisualStudio.DTE.8.0");

            DTE dte = (DTE)System.Activator.CreateInstance(t, true);

            try
            {
                dte.Solution.Open(@"C:\Temp\Temp.sln");

                //Wait some seconds to let VS open the solution
                System.Threading.Thread.Sleep(5000);
            }
            finally
            {
                dte.Solution.Close(false);
            }

Pablo

posted Thursday, April 20, 2006 12:06 PM by pga with 1 Comments

Whidbey Hosting Process

By default every time you compile a WindowsApplication or ConsoleApplication project using VS2005, a “vshost.exe” and a “vshost.exe.config” files are created on the \Bin\Debug and \Bin\Release paths.

The purpose of these “vshost.exe” and a “vshost.exe.config” files is described here.

To disable this feature you need to:

  1. Open a project in Visual Studio.
  2. On the Project menu, click Properties.
  3. Go to the Debug Tab
  4. Clear the Enable the Visual Studio hosting process check box.

Another common question is if we need to deploy these files and the answer is No, the "*.vshost.exe" and "*.vshost.exe.config" files are only for use in the Visual Studio 2005 IDE

Pablo

posted Wednesday, April 05, 2006 3:35 AM by pga with 1 Comments

The .42 Number

The version number of .NET v2.0 is 2.0.50727.42 and VS2005's one is 8.0.50727.42.

The convention used for this version numbering is YMMDD, this means that the final development push was on July 27 2005, and since that time they made 42 builds.

If you want to know about the history of the .42 number check http://blogs.msdn.com/quanto/archive/2005/10/27/486052.aspx

So, after v1.0.3705 and v1.1.4322 now comes v2.0.50727.42.

Pablo

 

posted Friday, October 28, 2005 4:00 PM by pga with 1 Comments

Visual Studio 2005 is out!!!

The final version of Visual Studio 2005 is available for download at MSDN subscriber. :)

There is also a *Trial* version of the Team Suite edition available for download.

Pablo

posted Friday, October 28, 2005 11:23 AM by pga with 0 Comments

WebProject References in Whidbey

As you may know, the web project file (.webproj) for a ASP.NET 2.0 Web Application is gone.

So one of the things that I look was how the references (in Everett the entry references were in the .webproj) were handled.

The conclusion is the following:

If you add a reference to a binary that is not in GAC, its going to be copied to the /bin directory.

If you add a reference to a binary that is in GAC, the entry for the reference is going to be added to the web.config:

   <compilation>
       <assemblies>
          <addassembly="xxx.xxx, Version=1.1.0.0, Culture=neutral, PublicKeyToken=xxx"  />
        <//< SPAN>assemblies>
    <//< SPAN>compilation>

If you add a reference to another project, the entry for the reference is going to be added to the solution file.

And thats how the references are handled in Whidbey.

 

Pablo

posted Thursday, September 15, 2005 1:05 AM by pga with 0 Comments

Whidbey RC

Whidbey RC was out 2 days ago, so I will download it and start playing with it.

The days for the RTM are counting...

Pablo

posted Thursday, September 15, 2005 12:48 AM by pga with 1 Comments

Solution Folders

One of the many new features of Visual Studio 2005 is the concept of solution folders.

You use them to organize the projects inside the solution, it is a logical organization because a solution folder does not map to physical directory in the file system.

For example if I create a solution folder named “DataAccess“ the following line is added to the sln file:

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataAccess", "DataAccess", "{7E6B9306-943C-4E3E-99B6-043C641FF75E}"

You can do several operations on a solution folder, for example you can hide/unhide them, unload all the projects contained on a solution folder, build all the projects, etc.

Links:

http://msdn2.microsoft.com/library/haytww03(en-us,vs.80).aspx

http://msdn2.microsoft.com/library/sx2027y2(en-us,vs.80).aspx

posted Friday, August 12, 2005 12:57 AM by pga with 0 Comments