Question

I'm having an issue with MSBuild 4.0 not resolving a path correctly in one of my imported MSBuild files. ProjectOne.csproj at the very beginning of the file imports GenericProject.proj.

GenericProject.proj then goes on to import the ProjectOne.settings file when it needs it via a call structured like:

<Import Project="$(MSBuildProjectName).settings" />

I had assumed that when the import was resolved it would have a path of something like:

/Project Root/Src/ProjectOne/ProjectOne.settings

But when running the ProjectOne.csproj through MSBuild I got a path of:

/Project Root/Targets/ProjectOne.settings

This doesn't make sense because considering all paths are suppose to be relative of the master project, in this case ProjectOne.csproj.

So I'm wondering if someone knows why this is happening?

Folder Structure:

  • Project Root
    • Src
      • ProjectOne
        • ProjectOne.csproj
        • ProjectOne.settings
    • Targets
      • GenericProject.proj

I don't think this matters, but just in case I'm running windows 7 x64

Edit: (1:45-11/7/2010) I was able to solve the problem by adding the $(MSBuildProjectDirectory) tag in front of $(MSBuildProjectName) but I still don't know why it wasn't resolving correctly in the first place.

Was it helpful?

Solution

all paths are suppose [sic] to be relative of the master project

Where did you get that idea?

<Import> elements are relative to the importing file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top