• A Failsafe For non-Debug TDS Builds

    Posted 09/15/2011 by techphoria414

    Another advantage of Team Development for Sitecore is that deployment to your various environments can be configured as part of the Solution's Build Configurations, allowing you to easily deploy either right from your desktop or as part of an automated build process. The side effect of this is that if you don't remember switching to say, your QA server's build configuration, you can easily deploy in-progress code to an environment that's not your local machine. (I will not confirm nor disconfirm I've done this.) Though you probably don't want your production environment fully configured in TDS anyway, even a deploy to a QA or UAT server would be enough to get someone knocking on your door asking why "everything is broken."

    We put together a quick failsafe to prevent this. You'll need to install the MSBuild Extension Pack. The example below assumes v4.0, x86. If the build is running in Visual Studio, and is anything other than a Debug build, a confirmation dialog appears that requires you to type in a super secret password before the build will continue. To add to your build, unload your TDS project, edit the .csproj, and paste in, perhaps near the bottom of the project config.

        <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks" />
        <Target Name="BeforeSitecoreBuild">
            <CallTarget Targets="ConfirmNonDebugBuild" Condition="'$(BuildingInsideVisualStudio)' == 'true' And '$(Configuration)' != 'Debug'"/>
        <Target Name="ConfirmNonDebugBuild">
            <MSBuild.ExtensionPack.UI.Dialog TaskAction="Prompt" Title="Confirm Build" Button2Text="Cancel" Text="Type 'whiskey' below to confirm build to $(Configuration)">
                <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>
                <Output TaskParameter="UserText" PropertyName="Typed"/>
            <Message Text="Button Text: $(Clicked) / Text: $(Typed)" Importance="high"/>
            <Error Condition="$(Clicked) == 'Cancel' Or $(Typed) != 'whiskey'"/>

    Read more... Pre-Disqus Comments (1)
  • TDS and Sitecore.* DLLs

    Posted 09/12/2011 by techphoria414

    Quick one for you. If you're using TDS for Sitecore, you've no doubt run into the issue that any DLLs starting with Sitecore.* will not deploy. Though an admirable protection against deployment of core Sitecore DLLs, it can be an issue with Shared Source modules that are not installed through packages, or Sitecore.Support.* DLLs. The quick fix is to unload your TDS project and edit its .csproj, and add a BeforeFileReplacements event handler such as the following.

      <Target Name="BeforeFileReplacements">
        <!-- restore certain Sitecore.* DLLs that TDS refuses to copy -->
        <!-- BeforeFileReplacements will be called after TDS has deleted Sitecore.*
        from its Output, but before it deploys -->
          <DeploySitecoreBinaries Include="$(SourceWebPhysicalPath)\Bin\Sitecore.SharedSource.Search.dll;" />
        <Copy SourceFiles="@(DeploySitecoreBinaries)"
    DestinationFiles="@(DeploySitecoreBinaries->'$(_OutputPath)bin\%(RecursiveDir)%(FileName)%(Extension)')" />

    UPDATE 9/14/2011: Changed the name of the Item Group. It was deploying everything in the bin\ folder, including Sitecore.Kernel. I assume because the group name SourceWebBinaries was previously used by TDS.

    Nick / @techphoria414