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

Notification

Icon
Error

Nested project imports not copied to NCrunch workspace?
ddewinter
#1 Posted : Tuesday, November 6, 2012 12:25:40 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/6/2012(UTC)
Posts: 2

Hi, I work in an environment where we have .csproj files that import a common targets file (through <Import Project="..." />), and that targets file imports other targets files, and so on. I notice consistently that only the immediately referenced targets file is copied to the NCrunch workspace. Other imports are mysteriously absent.

For the longest time I thought this was default behavior and found ways to work around it, but then I found this thread, which indicates this should not be the case.

I made something simple to repro this.

TestProj.csproj:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="(- BROKEN LINK -)">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{0013C4BD-C4B9-4364-A5CB-8C8C669D5699}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TestProj</RootNamespace>
    <AssemblyName>TestProj</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <Import Project="..\Build.targets" />
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


..\Build.targets (copied to NCrunch):

Code:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="(- BROKEN LINK -)">

  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>

  <Import Project="build\Build.targets" />

</Project>


build\Build.targets (not copied):
Code:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="(- BROKEN LINK -)">

  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
    <OutDir>..\bin</OutDir>
  </PropertyGroup>

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>$(OutDir)\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>$(OutDir)\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

</Project>


Any ideas?

Thanks,
David
Remco
#2 Posted : Tuesday, November 6, 2012 2:49:19 AM(UTC)
Rank: NCrunch Developer

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

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

Thanks for posting!

This is a known issue for which so far no reliable solution has been found. You can work around the problem by using the 'Additional files to include' setting to include the build files that are required by the included import.

Thanks for sharing the reproduction above - I'll see if I can make use of it when trying to solve the issue.


Cheers,

Remco
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download