Question

I'm trying to create a new C++ project in VS 10, and can't even get an empty project to load from the template. I get an error...

The "exists" function only accepts a scalar value but its argument "$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" evaluates to "{~}" which is not a scalar value.

The {~} value is what I have stored in the LOCALAPPDATA variable in the computer Environment Variables, concatenated with "\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props" at the end.

I'm reluctant to go changing any template files without understanding what's going on.

Was it helpful?

Solution 2

The links provided by @Mihai gave the information I needed to find a solution. The problem was that LocalAppData didn't have the value it was looking for (just what the error message says). I couldn't change that data because other apps had modified it for their own purposes (the value wasn't "~", that was a placeholder for this post).

Instead, I opened the .vcxproj file in Notepad, and modified the ImportGroup nodes causing the error. Instead of the attribute:

Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"

... it now reads

Condition="exists('$(UserProfile)\Local Settings\Application Data\Microsoft.Cpp.$(Platform).user.props')"

The project now loads.

OTHER TIPS

Well, it looks like Windows XP doesn't provide any default value for this variable and "~" is definitely not a valid directory on your PC. Try to set it as described here, and maybe you'll get lucky. VS2010 had some bug related to this. Perhaps you also need to upgrade it to SP1.

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