Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Having trouble Building One of my projects
ptaylor
#1 Posted : Tuesday, April 22, 2014 6:29:11 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/22/2014(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
I have a project that builds successfully when I build and run in visual studio but when I use NCrunch I get the following error

NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/d...ng_project-build-issues
..\..\..\..\..\..\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (4050): Cannot register assembly "C:\Users\myName\AppData\Local\NCrunch\8552\24\MyProjectFolder\bin\Debug\MyProject.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\MyProject.MyProjectClass' is denied.

I didn't think I was doing anything particularly odd on the build and I am not running Visual Studio as Admin to get it to build normally. Does anyone have any ideas on how I can get NCrunch to build this project?
Remco
#2 Posted : Tuesday, April 22, 2014 11:07:04 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
This error is being raised by the build step responsible for registering this assembly for COM interop. When UAC is enabled on your machine, the build process needs to be granted administrator privileges in order to perform the registration.

I'm not entirely sure why Visual Studio lets you build this project without you running it as administrator, but my guess would be that the assembly has already been registered before at its normal build path, so probably the build step is being skipped in this case.

COM registration of assemblies under NCrunch workspaces is probably not something you want to do as part of an NCrunch build. There's an easy way to suppress this behaviour when working with NCrunch. Open up the project file and look for the property:

<RegisterForComInterop>true</RegisterForComInterop>

.. And replace it with:

<RegisterForComInterop Condition="$(NCrunch) != '1'">true</RegisterForComInterop>

This will allow the COM registration to happen for any normal build, but it will be skipped when working with NCrunch. This will remove the need to run VS as administrator, while also improving your build performance.
1 user thanked Remco for this useful post.
ptaylor on 4/23/2014(UTC)
ptaylor
#3 Posted : Wednesday, April 23, 2014 11:04:10 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/22/2014(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
That worked fantastically. Thanks for the quick response and the great product.
Remco
#4 Posted : Wednesday, April 23, 2014 12:25:49 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Great! Thanks for confirming. Enjoy the product :)
ptaylor
#5 Posted : Wednesday, April 23, 2014 2:52:57 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/22/2014(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
I may have spoken too soon. The project builds...but then NCrunch seems to hang on some of the tests. Is there a log file or something I could provide you with to give you more information as to what is happening?
Remco
#6 Posted : Wednesday, April 23, 2014 9:56:54 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
This means we have now discovered the next problem :)

Are you able to get a debugger into the tests that are hanging? What can you tell me about these tests?
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.043 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download