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

Notification

Icon
Error

$(MSBuildThisFileDirectory) is not supported?
Leonid
#1 Posted : Wednesday, January 2, 2013 11:20:18 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/2/2013(UTC)
Posts: 7
Location: United States of America

Thanks: 2 times
We are using $(MSBuildThisFileDirectory) like in this example from MSDN:

http://msdn.microsoft.co...s/library/dd633440.aspx

Quote:
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), EnlistmentInfo.props))' != '' " />


It's used to walk up the directory tree to find the marker file, and allows you to keep your project files at an arbitrarily depth.

But NCrunch build will give an error such as:
The expression "[MSBuild]::GetDirectoryNameOfFileAbove('', EnlistmentInfo.props)" cannot be evaluated. The path is not of a legal form.

I changed $(MSBuildThisFileDirectory) to $(MSBuildProjectDirectory) and it worked (after I also added the actual file and the directory to AdditionalFilesToCopy).

This seems like a straightforward bug - maybe because this property is newish (it was not documented for VS2010).

Note MSBuildProjectDirectory will not work as a substitute to MSBuildThisFileDirectory in all cases, so my workaround is limited.

Hopefully future versions of NCrunch will support MSBuildThisFileDirectory.

Leonid
Remco
#2 Posted : Thursday, January 3, 2013 6:30:00 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 Leonid -

Thanks for reporting this issue. NCrunch relies on MSBuild abstractions when attempting to work with expressions such as this one. I'm wondering if this may be a .NET 4.0/4.5 version related issue of some kind. I'll take a deeper look and will see if I can identify a fix for it.


Cheers,

Remco
1 user thanked Remco for this useful post.
Leonid on 1/3/2013(UTC)
yaelf
#3 Posted : Sunday, November 30, 2014 4:36:30 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2014(UTC)
Posts: 1

We have recently bumped into this issue too when trying to enable NCrunch.
Are there any updates?

Thanks,
Yael
Remco
#4 Posted : Sunday, November 30, 2014 8:12:46 PM(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 Yael,

Unfortunately because of the location of the expression (Import condition), this eventually proved impossible to fix within NCrunch itself.

I recommend using an alternative way to derive the import target directory. Note that in most cases it is still possible to configure NCrunch to work with this scenario by including the file import file using the 'Additional files to include' configuration setting - see http://www.ncrunch.net/documentation/considerations-and-constraints_implicit-file-dependencies.
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.056 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download