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

Notification

Icon
Error

projects with path references, builds fail
mtijn
#1 Posted : Thursday, February 2, 2012 3:38:36 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/2/2012(UTC)
Posts: 1

I have been trying to get NCrunch running on my machine for half a day now and no matter what option I try or project setting I change I cannot get the builds to succeed. I keep getting this message:

Errors occurred while trying to load the project file:
The OutputPath property is not set for project 'nCrunchTemp_a3f1eb1a-f4ea-4d8a-8d0d-15377b2d5816'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

NCrunch: This error is commonly caused by projects that are relying on the selected build configuration provided by Visual Studio in order to set the $(Platform) and $(Configuration) MSBuild properties during a build. Unless configured otherwise, NCrunch will normally use the default $(Configuration) and $(Platform) properties that are specified in a .proj file - thus in order for your project to build with NCrunch it must be possible to build the project using command line MSBuild without needing to manually inject build properties. You will most likely need to edit your .proj file to align its default $(Configuration) and $(Platform) properties with the property groups provided in the file.

I should mention that all projects build their output and copy it in a postbuild step to my B drive which is a subst'ed drive for a single shared debug output folder of all the projects on my C drive.
Any references to other projects in the solution are not project references but references to the binaries on the B drive. Any 3rd party libraries are also on the B drive and referenced as such.

Yes, I know, a stupid way to setup project references and builds but that's what I have to work with and I cannot change it.

Btw, the NCrunch error message says Platform='AnyCPU' but I know for a fact this project property is set to x86. Changing the project property to 'AnyCPU' did not help though.

Can anyone here please post a clever comment that finally gets NCrunch going on my machine?
Remco
#2 Posted : Thursday, February 2, 2012 8:42:34 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)
Hi - thanks for posting.

Usually this is caused by an inconsistency between your Visual Studio build configuration (taken from the dropdown box at the top of your IDE) and the default build configuration specified in your .proj file. I don't think its possible that this issue is caused by your post build step, as NCrunch will disable post build events by default.

If you take a look at the top of one of your failing project files, you'll see something like this:


<PropertyGroup>

...

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

...

</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DEBUG|AnyCPU' ">
<OutputPath>bin\</OutputPath>

...

</PropertyGroup>

The topmost conditions (Configuration and Platform) are used to set what is considered to be MSBuild's default build configuration for the project. When Visual Studio builds a project file, it will inject the $(Configuration) and $(Platform) properties into MSBuild, overriding the defaults supplied in the project file. This is the primary function of the 'Build Configuration' dropdown box in your IDE's toolbar - basically this little option controls which values the $(Configuration) and $(Platform) properties should be set to.

Now, normally this isn't a problem, because most people will set up their build configuration under names like 'RELEASE' and 'DEBUG', which have already been coded into the project file. But lets just say we're working on a solution where we create a new build configuration - something like 'DEBUG-X86'. Inside this build configuration, we tell Visual Studio to use a $(Platform) of x86. Now when Visual Studio builds the projects, it will always inject a $(Configuration) of 'DEBUG-X86' and a $(Platform) of 'x86'. Odds are you've done some configuration on the project file itself, so you'll find in there that the 'DEBUG' PropertyGroup specified in the project file has been renamed to 'DEBUG-X86'. But if you look in the .proj file, you'll still see something like this:

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

Basically, the 'Default' build settings in the project file haven't changed, but the available configuration sets in the project file HAVE changed. The project has been configured to build with a default setting that doesn't exist - which is why it bombs out in NCrunch, as NCrunch will always use the default build configuration from the project file unless told otherwise.

So in conclusion, your project files are corrupt. You've been surviving because you likely only build your project via Visual Studio, and Visual Studio injects build properties that allow MSBuild to continue to function with corrupt files. You'll notice that if you try and run MSBuild against any of your projects using the command line, it will fail in the same way.

The good news is that this is really easy to fix. All you need to do is edit your project files and align the default configuration and platform properties to fit them with what you'd normally expect Visual Studio to inject. For example:

<Configuration Condition=" '$(Configuration)' == '' ">DEBUG-X86</Configuration>
<Platform Condition=" '$(Platform)' == '' ">X86</Platform>

I hope this solves the problem for you. If not, then I'm barking up the wrong tree and I might need a closer look at your build customisations - but I'm sure this is fixable :)
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.320 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download