$ (MSBuildProjectDirectory) and "program files (x86)"

I am using the MSBuildProjectDirectory property with MSBuild.

The project is located in:

C: \ Program Files (x86) \ Jenkins \ workspace \ MyProject

During build, MSBuildProjectDirectory is instead evaluated as:

C: \ Program Files% 28x86% 29 \ Jenkins \ workspace \ MyProject

and I get the message "Error in the system cannot find the file."

Do I need to move to another folder or can I get the correct path?

+6
source share
2 answers

If you are using Visual Studio 2010 / MSBuild 4.0, this will happen with certain properties that contain parentheses. Microsoft acknowledged that it was a regression error from VS2008 to VS2010 when using MSBuild 4.0: http://connect.microsoft.com/VisualStudio/feedback/details/532677/msbuild-4-0-usingtask-cannot-have-a-path -with-parentheses

According to the above link, the following problems have parentheses:

  • Using Task
  • MsBuildProjectDirectoryNoRoot
  • MsBuildProjectDirectory
  • MsBuildProjectFullPath

Resolution : while using MSBuild 4.0, change the location to a path that does not contain parentheses.

+6
source

Use

$ ([MSBuild] :: Unescape ('$ (MSBuildProjectDirectory)'))

instead

$ (MSBuildProjectDirectory)

0
source

All Articles