Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
661 views
in Technique[技术] by (71.8m points)

visual studio 2010 - nunit locking dll

I have been using nunit with visual studio 2010 on a windows 7 64-bit pc.

I am able to open the nunit gui and run my unit tests. If I then change one of the unit tests and try to rebuild, I am getting a file locking error as follows -

Error 1 Unable to copy file "objDebugmyProject.Tests.dll" to "binDebugmyProject.Tests.dll". The process cannot access the file 'binDebugmyProject.Tests.dll' because it is being used by another process. myProject.Tests

I have used process explorer to verify that it is the nunit-agent.exe that is locking the dll.

I have noticed via tools > test assemblies that the nunit.exe is running under clr version Net 2.0 and nunit-agent.exe is running under clr version Net 4.0. could that have something to do with the problem? If so, how can I fix it? If not, does anyone have any idea what else may be going on?

Thanks for any thoughts.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think this has to do with the placement of my test project. Initially, I was putting the nunit test project in a seperate directory from my dll files. I was thinking that I would keep all of my test projects in one centralized location.

I them moved my test project into the same location as my test dlls under my visual studio projects. After that, it seems to be working correctly.

I think this has to do the shadow copy. I read in the nunit group on google that the .net framework will only shadow copy assemblies in the application base or it's subdirectories.

This led me to try creating the nunit test project within my application base and that seemed to work.

Hope that makes sense.

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...