locked
DRAFT Instructions to update a 2008 guidance package to 2010 DRAFT RRS feed

  • General discussion

  • How to Update a Visual Studio 2008 Guidance Package to Visual Studio 2010

    Microsoft Visual Studio® 2010 development system and the Guidance Automation Toolkit (GAT) provide features that let you update guidance packages developed for Visual Studio 2008 so that they will work with Visual Studio 2010. This topic provides detailed instructions for converting, using the GAT to update the package.

    Converting the Guidance Package

    To convert a Visual Studio 2008 project to a Visual Studio 2010 project

    1.      Delete any previous .gpstate file before opening the project in VS 2010

    2.      On the Start menu, right-click Microsoft Visual Studio 2010, and then click Run as administrator.

    3.      Open the guidance package solution that you want to update. The Visual Studio conversion wizard will appear.

    4.      Complete the wizard steps to convert the solution to Visual Studio 2010.

    Note: You might receive the following error:

    Meta Guidance Package could not be loaded. Do you want to permanently remove the package from the solution?

    Click on NO, and then proceed with the conversion.

     

     Completing the Upgrade of the Guidance Package

    To complete the upgrade

    1.      On the Visual Studio Tools menu, select Guidance Package Manager, and then click Enable/Disable Packages.

    2.      Select Guidance Automation Toolkit, and then click OK to start the GAT.

    3.      With the Guidance Package Manager still open, select the UpdateGuidancePackageToVSIX recipe, and then click Execute.

    4.      Select the guidance package project that you want to update, and then click Accept. The UpdateGuidancePackageToVSIX recipe will make the following changes to the guidance package project:

    a.       Add the VSIX manifest file.

    b.      Add the Visual Studio SDK and Guidance Automation Extensions (GAX) targets (MSBuild) to the guidance package project.

    c.       Add the template files for VSIX.

    d.      Update the Wizard Extension version and the public key token

    5.      Wait for the recipe to finish, and then click Close.

    6.      After you run the UpdateGuidancePackageToVSIX recipe, check the <WizardExtension> element of each .vstemplate file. The Version should be changed to 2.0.0.0 and PublicKeyToken should be changed to 31bf3856ad364e35. If the values have not been changed, in each .vstemplate, find all instances of the Version and PublicKeyToken in the <WizardExtension> section, and change them to the correct values.

    The final <WizardExtension> section for each .vstemplate should look like the following example.

    <WizardExtension>

     

    <Assembly>

    Microsoft.Practices.RecipeFramework.VisualStudio, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

    </Assembly>

     

    <FullClassName>

    Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate

    </FullClassName>

     

    </WizardExtension>

     

    Note: You should change the Version and PublicKeyToken in the <WizardExtension> elements. Do not change these values in other elements.

    7.      After you update the templates, open the solution, and delete the Installer and Setup projects. For example, if you use the sample included with the GAT, you would delete the GuidancePackageInstaller and GuidancePackageSetUp projects.

    8.      Change the hint path for reference assemblies to use RecipeFrameworkPath as follows:

    a.       Open the .csproj file of the guidance package project in a text editor such as Notepad. Add the following element under the <PropertyGroup> parent element.  

    <RecipeFrameworkPath>

    %VSINSTALLDIR%Common7\IDE\Extensions\Microsoft patterns and practices\GAX\<Version>

    </RecipeFrameworkPath>

    b.      In the .csproj file of the guidance package project, replace the folder reference in each HintPath with $(RecipeFrameworkPath) so that the code looks like the following example.

    <HintPath>$(RecipeFrameworkPath)\Microsoft.Practices.Common.dll</HintPath>

    c.       Save and close the .csproj file.

    d.      Reload the guidance package project in Visual Studio 2010 integrated development environment (IDE).

    9.      Open the files in the Actions folder, and replace the base class Action on the class declaration with Microsoft.Practices.RecipeFramework.Action.  

    10.  Configure the debugging setting to start Visual Studio 2010 as an experimental instance. Open the guidance package project Property window, set the debug location to devenv.exe, and set the command line argument to “/rootSuffix Exp”. For more information, see The Experimental Instance of Visual Studio on MSDN (http://msdn.microsoft.com/en-us/library/bb166560(VS.100).aspx).

    11.  Build the solution. Go to the \bin\Debug folder of the guidance package project, and verify that the .VSIX file was created.

     

    Debugging the Upgraded Guidance Package

    To debug the converted Guidance Package

    1.      Reset the Visual Studio 2010 experimental hive as follows:

    a.       On the Start menu, select All Programs and then select Microsoft Visual Studio 2010 SDK.

    b.      On the Tools menu, select Reset the Microsoft Visual Studio 2010 Experimental Instance.

    2.      Clean and rebuild the guidance package solution.

    3.      Press Ctrl + F5. This starts an experimental instance of Visual Studio.

    4.      In the new instance, on the File menu, select New, and then select Project. Create a project that is the type of the guidance package you just created. You are now ready to execute the guidance package recipes. 

    Note: Some of the recipes might be missing. You can add them by using the AddRecipeReference recipe.

     

    Troubleshooting

    You might receive the following error message when you open an old Guidance Package solution containing a web project:

    Error HRESULT E_FAIL has been returned from a call to a COM component.

    This occurs because the Web site (or other project) points to .NET Framework 2.0.

    To resolve this error

    1.      Click OK to continue building the solution.

    2.      After the solution is created, right-click the Properties of the Web site (or other project), and then change the Target Framework property under the Build tag to point to .NET Framework 4.0.

    3.      Save your changes, and build the solution. The solution should now build successfully.

     

    Wednesday, March 17, 2010 10:11 PM

All replies

  • Hi,

    I tried this and I found some tips.

    -  %VSINSTALLDIR% should be used as $(VSINSTALLDIR). But it does NOT work either. I had to hardcode path to gax. And at the end there must be GAX 2010\2.0.20312.0. So it should be to get it work properly

    C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft patterns and practices\GAX 2010\2.0.20312.0

    - Dont forget to change references from old Visual Studio 9\publicAss\Microsoft.Practices to new asseblies in GAX 2010\2.0.20312.0.

    With these "mods" i get run old Guidance for solution Templates.

    I'll post here more when I find more :-)

    Sunday, March 21, 2010 4:40 PM
  • Hi,

    It works with %VSINSTALLDIR%. We had left a place holder at Step 8 for Version  

    <RecipeFrameworkPath>

    %VSINSTALLDIR%Common7\IDE\Extensions\Microsoft patterns and practices\GAX\<Version>

    </RecipeFrameworkPath>

    We will modify the instructions to have the current version number instead of a placeholder.

    The current version number is 2.0.20312.0

    Let us know if you find anything else.

    Thanks,

    Meenakshi

    Monday, March 22, 2010 5:26 PM
  • I've seconding hellx's comment about the %VSINSTALLDIR% variable expansion. I couldn't get it to work either without hardcoding in the full path. The problem I experienced was that the current directory would get prepended, the variable would blank, and the rest would be added. While %VSINSTALLDIR% is available in my environment (I can access it from the command prompt and it's correct), neither it nor $(VSINSTALLDIR) would work in the build script.

     

    Wednesday, April 21, 2010 12:30 AM
  • Something you might want to emphasize is the HintPath element. In all but one case, none of the GAX assemblies in my project had HintPath elements. I needed to add them, though, to steer the build away from the 9.0 versions of the libraries.

    Note, though, that I have both VS 2008 and VS 2010 installed, and both GAX/GAT installations as well.

    -- Michael

     

    Wednesday, April 21, 2010 12:50 AM
  • Hi,

    I am trying to convert guidance package of vs2008 to vs2010,

    followed instructions as per this link {http://msdn.microsoft.com/en-us/library/ff697211.aspx}

    and getting error as

     

     

    Error 1  The "GenerateMenuResource" task failed unexpectedly.

    Microsoft.Practices.RecipeFramework.RecipeFrameworkException: Unexpected error loading template file name .\bin\Release\Templates\Solutions\Copy (2) of SampleSolution.vstemplate. Make sure that the template is well formed and try again. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Projects\Live\Test Guidance Package\Test_Guidance\bin\Release\Templates\Solutions\Copy (2) of SampleSolution.vstemplate'.

       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)

       at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)

       at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)

       at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)

       at System.Threading.CompressedStack.runTryCode(Object userData)

       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)

       at System.Xml.XmlTextReaderImpl.OpenUrl()

       at System.Xml.XmlTextReaderImpl.Read()

       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

       at System.Xml.XmlDocument.Load(XmlReader reader)

       at System.Xml.XmlDocument.Load(String filename)

       at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.TemplateMetaData.ReadTemplate()

       --- End of inner exception stack trace ---

       at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.TemplateMetaData.ReadTemplate()

       at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.TemplateMetaData..ctor(String templateFileName, CommandID command, String packageName, RegistryKey registryRoot)

       at Microsoft.Practices.RecipeFramework.VisualStudio.Build.GenerateMenuResource.CompileCTO(String& tempCTO)

       at Microsoft.Practices.RecipeFramework.VisualStudio.Build.GenerateMenuResource.Execute()

       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

       at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) Test_Guidance


     

    can anyone have solution for this?

    Thursday, August 12, 2010 7:23 AM
  • Hi,

     

    Please clean the output path folders (bin\Debug, bin\Release, obj, etc) and make sure the files of the templates are configured as following:

     

    Build Action=Content

    Copy To Output Directory=Copy if newer

    Include in VSIX=True

     

    Thanks,

    Adrian


    Adrian Alonso - http://adrianalonso.blogspot.com/
    Tuesday, October 19, 2010 2:46 PM
  • Hi,

     

    Please clean the output path folders (bin\Debug, bin\Release, obj, etc) and make sure the files of the templates are configured as following:

     

    Build Action=Content

    Copy To Output Directory=Copy if newer

    Include in VSIX=True

     

    Thanks,

    Adrian


    Adrian Alonso - http://adrianalonso.blogspot.com/

    I was having the same error and the problem was with an older .vstemplate not included in the project. 
    joaoalmeida.info
    Friday, December 17, 2010 4:57 PM
  • Indeed, the Guidance Package project includes all existing *.vstemplate files in the build even if they are not added to the project. I had to delete some old excluded folders that contained either SampleProjects or old projects not being used anymore.

     

    Juan

    Tuesday, May 24, 2011 4:21 PM