Reputation: 367
I am trying to use a target at a relative location from the project in the source control using the following entry in the .csproj
<Import Project="..\..\Shared\Build\Tools\Targets\config.transform.targets" Condition="Exists('..\..\Shared\Build\Tools\Targets\config.transform.targets')" />
the Shared folder mentioned in the below path is two levels above the .csproj file location as in Dashboard\Shared\Build\Tools\Targets Dashboard\Admin\ConfigurationConsole\ConfigurationConsole.csproj
Locally the project & the solution build fine, but when queued on the build server it fails with the following error.
TransformWebConfig does not exist in the project.
So after trying many things when i finally changed the relative path to the below it worked.
<Import Project="..\Shared\Build\Tools\Targets\config.transform.targets" Condition="Exists('..\Shared\Build\Tools\Targets\config.transform.targets')" />
Would like to know whats happening here and what could be an apt solution that runs everywhere.
Upvotes: 0
Views: 1208
Reputation: 367
actually the better way to point to a relative path was to force the current path to be current project directory using the $(MSBuildProjectDirectory) environment variable
Relative paths with MSBuild project vs solution
MSBuild: convert relative path in imported project to absolute path
Upvotes: 1