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

Notification

Icon
Error

Recommended project file modifications "corrupt" sln file.
openshac
#1 Posted : Wednesday, January 21, 2015 4:24:05 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/19/2015(UTC)
Posts: 14
Location: United Kingdom

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
I enabled NCrunch for a solution with about 20 projects. I got load failures for some of the projects so I followed the recommendations on the Project Build Platform And Configuration page and modified the PropertyGroup xml as recommended. The projects then built successfully.

However as soon as I saved my solution I noticed that my .sln file had changed/been corrupted.

This section of the .sln file
Quote:
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Any CPU.ActiveCfg = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Any CPU.Build.0 = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Mixed Platforms.ActiveCfg = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Mixed Platforms.Build.0 = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Win32.ActiveCfg = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Win32.Build.0 = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|x86.ActiveCfg = Debug|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|x86.Build.0 = Debug|x86


was changed to:

Quote:
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Any CPU.ActiveCfg = Debug (Server)|x86

{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Mixed Platforms.ActiveCfg = Debug (Server)|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Mixed Platforms.Build.0 = Debug (Server)|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Win32.ActiveCfg = Debug (Server)|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|Win32.Build.0 = Debug (Server)|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|x86.ActiveCfg = Debug (Server)|x86
{4767FA9B-1487-4023-A380-B070F8C6A465}.ASPNET Debug|x86.Build.0 = Debug (Server)|x86


Where Debug Server is a custom configuration that I am using.

When I click on the project properties Debug is now missing from the Configuration dropdown too. It's also missing in the solution configuration tool.

One thing I've noticed is that the first PropertyGroup in my project file has:

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


Changing AnyCPU to x86 seems to make the problem go away, but I don't understand why or if this is a valid change.
In my original Mickey Mouse solution that I used for initial testing of NCrunch having AnyCPU specified didn't cause any problems.

Could you explain what I am doing wrong?

Thanks
Remco
#2 Posted : Wednesday, January 21, 2015 9:33:42 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

The solution file needs to work in alignment with the configuration groups specific inside the project files. VS must have automatically aligned the project file as soon as it worked out that you'd fixed up your project files. Note that you can easily create a new solution configuration inside the VS configuration manager to represent any updated configuration groups inside your project files.

I can't for certain say why changing the platform from AnyCPU to x86 would allow NCrunch to build your projects. This would depend upon the structure of your solution and the nature of the error. My first guess would be that you have a project (or a DLL) which is set to build only to x86, and therefore requires those projects depending on it to be built for the same platform. AnyCPU and x86 do create small differences in the DLL file that is output from the compiler, and they are not necessarily compatible at run time. It may be worth working your way up the dependency chain inside your solution to figure out which project requires x86, then examine its references to see if there is a reason for it.
Daniel Rose
#3 Posted : Thursday, January 22, 2015 10:32:15 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/7/2011(UTC)
Posts: 29
Location: Aachen, Germany

Thanks: 6 times
Was thanked: 5 time(s) in 4 post(s)
The code in the project file means "if no value for the variable Platform is set, then set it to AnyCPU". However, from your description, your project does not have such a platform. So when - for whatever reason - NCrunch builds the project without any platform set, the platform is set to AnyCPU. But since the rest of your project file uses x86, all the settings particular to that platform are not set, resulting in your problems.

This error does not occur in your initial testing solution because you likely had a platform AnyCPU there.

Note that the project files generated by Visual Studio use AnyCPU as default value if nothing is set. This is unfortunately never adjust by VS, even if you delete that platform. The same is true for the configuration, which defaults to Debug. So you'll need to manually edit the project file.
1 user thanked Daniel Rose for this useful post.
Remco on 1/22/2015(UTC)
openshac
#4 Posted : Thursday, January 22, 2015 11:15:41 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/19/2015(UTC)
Posts: 14
Location: United Kingdom

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
Thanks for your email Daniel,

So are you saying that it's OK for me to change AnyCPU to x86 at the top of each project file?
Daniel Rose
#5 Posted : Thursday, January 22, 2015 3:25:11 PM(UTC)
Rank: Member

Groups: Registered
Joined: 10/7/2011(UTC)
Posts: 29
Location: Aachen, Germany

Thanks: 6 times
Was thanked: 5 time(s) in 4 post(s)
Exactly. This should match one of the actual platforms in your project file.

Note that this is only used when no platform value is set. When building from Visual Studio, it always sets the value, so you could write whatever you wanted and wouldn't notice any difference.
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.045 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download