• SCSF Solution file is checked out from TFS when it is opened in Visual Studio 2008 SP1

    Published by on February 18th, 2009 5:19 am under Composite Application Block (CAB), Patterns and Practices (P&P), Smart Client Software Factory (SCSF), Team Foundation Server (TFS), Visual Studio (VS)

    4 Comments

    The UX Patterns & Practices (Sustained Engineering) team was working on a task trying to find the causes why the solution file of an SCSF Solution is checked out from Team Foundational Server (TFS) when it is opened in Visual Studio 2008 SP1. We found that the issue appears when some properties are added to the GlobalSection(ExtensibilityGlobals) section inside the Solution file. So we created a workaround that saves the properties that cause the automatic checked out in other file than the solution file, an XML file.

    Note: This issue was investigated based in a customer’s problem who uses TFS as Source Control, but it is possible that the issue appears when the solution is binded to other Source Control for the same reason. Also, the provided workaround should work in your case too.

     

    Cause of the Issue

    As I said, we detected that the issue appears when some properties are added to the GlobalSection(ExtensibilityGlobals) section inside the Solution file. After trying to find the cause in different environments (with different configurations among Visual Studio 2008 SP1, GAX & SCSF), we arrived to the conclusion that the issue is not related neither to GAX nor SCSF, and may be related directly to Visual Studio (because the issue also appears without GAX & SCSF).This issue appears when creating a SCSF solution, because the GP happens to store some properties in this section, but the checkout when opening the solution everytime is not caused by SCSF itself.

     

    Workaround

    To avoid using the problematic section in the solution file, we created a custom SCSF Guidance Package that saves the content of this section in a separated XML file. In this way, the Visual Studio does not get knowledge about these properties avoiding the check out.

     

    Downloads

    Here you can find some stuff that you should use to fix the Guidance Package with the Workaround, or, if you prefer, you can download directly the fixed Guidance Package or an installer:

    Disclaimer: The code is provided “AS IS” with no warranties, and confers no rights.
    Note: The Visual Studio 2008 SP1’s fixes was provided by Mariano Converti, you can find more information about these in his post.

     

    Steps to update the Guidance Package

    To perform these steps you should download the SCSF GP (fix for TFS) – Modified Classes.zip file from the Downloads section and install GAT 2008.

    1. Open the SCSF Guidance Package.
    2. Create a new Global Value Provider class named XmlGlobalValueProvider. Located it in \SmartClientFactoryPackage\ValueProviders folder of the Guidance Package solution. The code for this class can be found in the downloaded zip file.
    3. Update SetGlobalValueAction class to use XML file. The class is located in the \SmartClientFactoryPackage\Actions folder of the Guidance Package solution. The code for this class can be found in the downloaded zip file.
    4. Update all references to “Microsoft.Practices.RecipeFramework.Library.ValueProviders.GlobalValueProvider, Microsoft.Practices.RecipeFramework.Library”. They should now reference Microsoft.Practices.SmartClientFactory.ValueProviders.XmlGlobalValueProvider. This can be done by using Quick Replace.
    5. Update ViewTemplateReferenceCS and ViewTemplateReferenceVB classes, so they get the CommonProjectGuid from the xml file. The code for this classes can be found in the downloaded zip file.
    6. Important: If you use this without the fix for VS2008 SP1, you will need to replace this line:
                if (reference.Name == referenceIdentity) return true;
      in both classes for this one:
                if (reference.Identity == referenceIdentity) return true;

    7. Open the Recipes\Common\CreateSmartClientFactorySolutionCommon.xml.
    8. Add the <Input Name=”SolutionPath” RecipeArgument=”SolutionDir” />  tag to each of these actions:
      • SaveRootNamespace
      • SaveShellProjectGuid
      • SaveCommonProjectGuid

      For example:
      <Action Name=SaveRootNamespaceType=Microsoft.Practices.SmartClientFactory.Actions.SetGlobalValueAction, Microsoft.Practices.SmartClientFactory.GuidancePackagePersistValue=trueValueName=RootNamespace>
      <
      Input Name=SolutionPathRecipeArgument=SolutionDir/> <!–ADDED TAG TO ACTION–>
      <
      Input Name=ValueRecipeArgument=RootNamespace/>
      </
      Action>

    9. Register the Guidance Package.

     

    Steps to update the Source Control files

    This steps are required if you have an existing solution that you want to use with the new Guidance Package:

    1. Open the solution file of the SCSF Solution for edit (i.e in notepad) and cut the Global Section(Extensibility Globals) section entirely. You will use the values from this section in the next step.
    2. Create an XML file in the same directory where your solution file is located named global.xml. Its content should be this:
      <GlobalSection>
          <
      ShellProjectGuid>{YOUR SHELL PROJECT GUID}</ShellProjectGuid>
          <
      CommonProjectGuid>{YOUR COMMON PROJECT GUIDE}</CommonProjectGuid>
          <
      RootNamespace>{YOUR ROOT NAMESPACE}</RootNamespace>
      </
      GlobalSection>

      For example (using the values that you copied from the solution file):
      <GlobalSection>
          <
      ShellProjectGuid>90ae59ae-e404-4102-9076-9fe9ca60f47e</ShellProjectGuid>
          <
      CommonProjectGuid>9993ae7c-e9ea-4e6a-8374-c8f213bc9721</CommonProjectGuid>
          <
      RootNamespace>MySolutionNamespace</RootNamespace>
      </
      GlobalSection>
    3. Check both files in.
    4. Open the solution in Visual Studio and check that the new Guidance Package is enabled.

    In this way, the next time you open the solution in Visual Studio, the solution file should not be checked out.

    I hope this helps you. Please, leave your comment if you have any doubt about the issue or the workaround.

    Thanks,

    Eze

    • Martin Darilek

      Hello,

      we have the same issues with checking-out solutions as You described above. But given hyperlinks for downloading patches does not work. Is it possible create new correct download site?

      Thanks

      Martin D.

    • esculli

      Thanks Martin for the information, I have fixed the links, so you should be able to download the different files.
      Please, contact me again if you have problems with the solution or implementing it.

      Greetings,
      Eze

    • http://blogs.microsoft.co.il/blogs/urig/ Uri Goldstein

      Hi Ezequiel,

      I’m experiencing a similar problem after having installed a DXCore add-in called CodeStyleEnforcer. It has nothing to do with the SCSF. However, it also embeds a GlobalSection(ExtensibilityGlobals) section and also triggers a checkout of the .sln every time it is opened.

      Would you happen to know what the cause of the problem is? The workaround naturally will not solve my problem.

      Thanks,
      Uri

    • http://www.geeks.ltd.uk/Services.html software development uk

      Interesting,

      thanks for those download links and your examples keep up the good work

      Thanks for bringing this up