December 13, 2024

Dear Sitecore Family!

Hope you are doing good.

Challenge:

Many of us might have faced this with Sitecore TDS projects, that while build it gives us this error. 

The solution is quite simple, the only bigger problem, is the error doesn’t help in understanding from where it is generating.

So, when I faced this for the first time, I went and changed the log verbosity for TDS from normal to detailed – hoping that I would get more information – but I was unsuccessful.

Later, I checked online and found a Solution.

Solution:

We need to update the scproj file – basically the TDS Project file – but Long story short – make sure that the following 2 things happen:

  1. HedgehogDevelopment.TDS.targets is referred to from Nuget packages instead of from system
  2. The location of the file – is correctly mapped – using “..\” to reach the exact folder where the HedgehogDevelopment.TDS.targets is located in reference to the TDS Project file location

The following piece of XML in the TDS Project file helped me fix my error and posting it here so that in case you face the same, I hope it helps you too.

<Import Project="..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets" Condition="Exists('..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Import Project="..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets" Condition="Exists('...\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets')" />
    <Error Condition="!Exists('..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets'))" />
  </Target>
  <Import Project="..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets" Condition="Exists('..\..\..\..\packages\HedgehogDevelopment.TDS.6.0.0.12\build\HedgehogDevelopment.TDS.targets')" />

Make sure you are adding it right before the ending Project XML Tag. 

Happy Problem Solving and Happy Sitecoring! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *