# Relative paths in imported projects - documenttation mismatch??

### Question

• Hi, All!

MSDN tells about MSBuild project importing:

All relative paths in imported projects are interpreted relative to the directory of the importing project.

Well, is it just that i need?

I need to import MSBuild.Community.Tasks.targets file, that describes Zip task.

MSBuildCommunityTasks.targets defines property MSBuildCommunityTasksPath, that can be used to locate MSBuild.Community.Tasks assembly.

In my case, MSBuild.Community.Tasks is not installed to default location, but placed not far from project directory, by some relative path (..\externals\MSBuildCommunityTasks).

I try to replace default value of property MSBuildCommunityTasksPath just before import:

<PropertyGroup>
</PropertyGroup>

But on msbuild run, the error occurs:

That looks like MSBuild try to interpred path from property MSBuildCommunityTasksPath not relative to the primary, importing project (as MSDN defines), but relative to imported project, MSBuild.Community.Tasks.targets.

How i can import  MSBuild.Community.Tasks.targets by relative path (..\externals\MSBuildCommunityTasks), and give it the property MSBuildCommunityTasksPath, containing the relative path to the same directory (..\externals\MSBuildCommunityTasks), so, that  MSBuild.Community.Tasks.targets can use this path correctly?

Monday, August 20, 2007 12:56 PM

• I meant, you can just prefix them with that. For example:

(in your imported file)

<MyItemType Include="$(MSBuildProjectDirectory)\..\my\path\..\relative\to\importing\project.foo"/> Wednesday, August 22, 2007 12:08 AM ### All replies • Hi JD21, You're right, I've passed this feedback onto our documentation guy. Try making your relative path into a full path by using$(MSBuildProjectDirectory).

Dan

Tuesday, August 21, 2007 5:50 PM
• How i can convert relative path to full path?

Tuesday, August 21, 2007 6:03 PM
• I meant, you can just prefix them with that. For example:

(in your imported file)

<MyItemType Include="\$(MSBuildProjectDirectory)\..\my\path\..\relative\to\importing\project.foo"/>

Wednesday, August 22, 2007 12:08 AM
• Oh, i see. Thanks!

Wednesday, August 22, 2007 10:40 AM