Martin Hinshelwood

A Scottish software developer: SSW Solution Architect & Microsoft Visual Studio Team System MVP
posts - 392, comments - 528, trackbacks - 57

My Links

News

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.




TwitterCounter for @hinshelm



Locations of visitors to this page

Subscribe

Personal

Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

Blogs I read

Blogs of Friends

Personal

Projects

VSTS

TFS Error: MSB4018 The "BuildShadowTask" task failed unexpectedly

There seams to be a problem in MSBuild when you add an “Accessor” as part of a Unit Test project.

C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\TeamTest\Microsoft.TeamTest.targets(14,5): error MSB4018: The "BuildShadowTask" task failed unexpectedly.
System.IO.FileLoadException: API restriction: The assembly 'file:///C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
   at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.WebBinder.LoadData()
   at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.WebBinder.Init()
   at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower..ctor()
   at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)

 

An Accessor allows your test project to access code that would normally be “Private” or “Friend” from outside the Assembly that it resides in.

image

It creates a little file with the “.accessor” extension that is the same name as your DLL, and contains the name of the DLL.

image

If you remove this file then your remote MSBuild server will then build you solution successfully again including running your Unit Tests.

 

Reference:

Re: BuildShadowTask Failed unexpectedly - Accessor Problem (Upconvert VS 2005 to 2008) – URGENT

BuildShadowTask Failed unexpectedly - Accessor Problem (Upconvert VS 2005 to 2008) – URGENT

 

Print | posted on Thursday, July 03, 2008 4:54 PM |

Feedback

Gravatar

# re: TFS Error: MSB4018 The "BuildShadowTask" task failed unexpectedly

This did indeed fix my problem. I'm using TeamCity, but the problem was the same. Thanks a ton! At first, I passed by this blog entry because I found it hard to believe the solution was so simple. Glad I came back after a little time of walking around and pondering.
10/6/2008 9:25 PM | Bryan
Gravatar

# re: TFS Error: MSB4018 The "BuildShadowTask" task failed unexpectedly

Work Like a charm dude
2/26/2009 5:32 AM | Nripin Babu
Gravatar

# re: TFS Error: MSB4018 The "BuildShadowTask" task failed unexpectedly

Just, thanks for the explanation, I was wondering what the accessor was....
6/18/2009 4:25 PM | simon burgoyne
Comments have been closed on this topic.

Powered by: