July 23, 2024

Dear Readers,

I was making a new TDS project in my solution today, when I and my team mates faced the following error:

Challenge:

Error The “VerifyTDSVersion” task failed unexpectedly.
System.IO.FileLoadException: API restriction: The assembly ‘file:///C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.Tasks.dll’ has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
at HedgehogDevelopment.SitecoreProject.Tasks.VerifyTDSVersion.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() TDS.Delta.NoNameRelease C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets 164

 Solution:

I found, 2 solutions for this.

Solution 1:

I remember I faced this once, in one of the past projects. I restarted my Visual Studio and it worked. I did the same here, but somehow it didn’t work this time.

Solution 2:

We have HedgehogDevelopment.TDS.X.X.X.XX version added to our solution. We have configured Auto Deployment using Team City and Octopus Deploy. When I opened an older TDS project and the new one which was just created, I found a difference! There was a extra line in the old project, which wasnt in my new project.

I found the following extra line:

[code language=”xml”]

<Import Project="..\packages\HedgehogDevelopment.TDS.5.6.0.15\build\HedgehogDevelopment.TDS.targets" Condition="Exists(‘..\packages\HedgehogDevelopment.TDS.5.6.0.15\build\HedgehogDevelopment.TDS.targets’)" />

[/code]

I copied this same line to my new project and the issue that the error got solved.

Conclusion: In case you face an issue regarding TDS projects, its also good to check for whether you have a HedgehogDevelopment.TDS.X.X.X.XX package added via Nuget.

Hope this helps someone in the Sitecore World.

Happy Sitecoring! 🙂

2 thoughts on “The VerifyTDSVersion task failed unexpectedly

  1. Thanks for this I have noticed that a check to see if the project is building in Visual Studio, can be added in either the import or the related error node. changing the location seems to have a effect on it, and I will look to publish my findings once I’m happy with my investigation.

Leave a Reply

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