The VerifyTDSVersion task failed unexpectedly

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:


<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')" />

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! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s