Code Snippet: Sitecore & TDS

April 24, 2015

Blog | Development | Code Snippet: Sitecore & TDS
Code Snippet: Sitecore & TDS

When using TDS to deploy a Sitecore site, you may run into issues with dlls not deploying properly (especially dlls starting in Sitecore).  This often happens when using anything from SharedSource, and pulling from a relative “lib” directory.  Below is a Code Snippet that will help ensure your Sitecore SharedSource Dlls will be deploy correctly when you use TDS.

In your TDS, edit the actual project file in XML, and at the very end of the file, add the following:

<Project>
    ...
    <Import Project="$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject 9.0\HedgehogDevelopment.SitecoreProject.targets" />
    <Target Name="BeforeFileReplacements">
        <!-- restore certain Sitecore.* DLLs that TDS does not copy -->
        <!-- BeforeFileReplacements will be called after TDS has deleted Sitecore.* from its Output, but before it deploys -->
        <!-- Let's try a wildcard with the SharedSource piece, time to whitelist! -->
        <ItemGroup>
            <DeploySitecoreBinaries Include="$(SourceWebPhysicalPath)\Bin\Sitecore.SharedSource.*.dll;" />
        </ItemGroup>
        <Copy SourceFiles="@(DeploySitecoreBinaries)" DestinationFiles="@(DeploySitecoreBinaries->'$(_OutputPath)bin\%(RecursiveDir)%(FileName)%(Extension)')" />
    </Target>
</Project>

 

What other tutorials and tips would you like to see? We’d love to hear from you. Reach out @GeekHive!

 

Steve VandenBush

Technical Lead
Tags
  • Sitecore
  • Tutorial

Recent Work

Check out what else we've been working on