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

Notification

Icon
Error

Issue with building some projects from solution.
gorczas
#1 Posted : Thursday, November 30, 2017 2:51:25 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2017(UTC)
Posts: 3
Location: Poland

Thanks: 1 times
Hi,

I have downloaded the newest version of nCrunch today and I'm using it with VS 2017. I have solution with 98 projects and few of them are failing because of this error:

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. For more information about this problem please refer to http://www.ncrunch.net/d...tform-and-configuration

I have checked linked workaround and checked my .csproj file and my .csproj file look fine (like the one described in article)

I can post just few bits from this file, but I think that it will be enough.

Code:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <Optimize>false</Optimize>
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>ProjectName.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>none</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>ProjectName.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{62812A0A-352D-4D2C-91C5-F5F058F171D4}</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ProjectName</RootNamespace>
    <AssemblyName>ProjectName</AssemblyName>
    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
    <OldToolsVersion>4.0</OldToolsVersion>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
    <RestorePackages>true</RestorePackages>
  </PropertyGroup>


What can I do to fix this issue?
Remco
#2 Posted : Thursday, November 30, 2017 10:54:54 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

In this case, it looks like the declarations for your configuration and platform have been moved to the bottom of the file, so they are executing too late in MSBuild's evaluation order. Move the bottom-most PropertyGroup to the top of the file and the issue should be resolved.
gorczas
#3 Posted : Friday, December 1, 2017 10:01:08 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2017(UTC)
Posts: 3
Location: Poland

Thanks: 1 times
Remco;11589 wrote:
Hi,

In this case, it looks like the declarations for your configuration and platform have been moved to the bottom of the file, so they are executing too late in MSBuild's evaluation order. Move the bottom-most PropertyGroup to the top of the file and the issue should be resolved.



THose configuration that I have posted are just after those lines:

Code:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="CustomConfigTransform;Build" xmlns="(- BROKEN LINK -)" ToolsVersion="12.0">
  <PropertyGroup>
    <UseIISExpress>false</UseIISExpress>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <TargetFrameworkProfile />
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <UseGlobalApplicationHostFile />
    <Use64BitIISExpress />
  </PropertyGroup>


So I should move those 3 PropertyGroups from my initial post before this one property group?
Remco
#4 Posted : Friday, December 1, 2017 11:29:43 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
This code block should be at the top of your file:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ProjectName.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>


If there's any doubt, try running MSBuild.exe over your project. This is more or less what NCrunch does. When MSBuild can build your project, NCrunch will also be able to.
1 user thanked Remco for this useful post.
gorczas on 12/5/2017(UTC)
gorczas
#5 Posted : Tuesday, December 5, 2017 7:57:08 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2017(UTC)
Posts: 3
Location: Poland

Thanks: 1 times
Thanks,

now it works fine.
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.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download