|
#1
|
|||
|
|||
problem with backslash and "replace in file"
I need to replace in file a path, this path contain backslash \. How I do?
Thanks |
#2
|
|||
|
|||
When using regex mode ('Treat all characters as literals' unchecked) in the Replace in File action, \ is an escape character; use \\ to match a literal backslash character. See the regular expression references listed at http://visualbuild.com/Manual/?filereplaceaction.htm for more details.
|
#3
|
|||
|
|||
what if I want to replace a text with a variable %WORK_ROOT%
where %WORK_ROOT% defined as c:\temp\bin? After testing my step I'm getting : <HintPath>c:tempbin</HintPath> (missing backslashes) |
#4
|
|||
|
|||
[Replace("%WORK%_ROOT%", "\", "\\")]
http://www.kinook.com/VisBuildPro/Ma...xpressions.htm http://www.w3schools.com/Vbscript/func_replace.asp |
#5
|
|||
|
|||
thanks it some how works but doesn't fully do what I intended to do. I should've posted all my string.
I've solved a problem with backslashes but now I'm getting a problem with a $ I need to insert this string %WORK_ROOT%\bin\$ConfigurationName between <HintPath> tags. where %WORK_ROOT% is defined as c:\temp after implementing your tip I'm getting: <HintPath>c:\temp\bin\$ConfigurationName<\HintPath > can't figure out how to solve a problem with the $ symbol. I'm expecting to see: <HintPath>c:\temp\bin\Debug<\HintPath> <HintPath>c:\temp\bin\Release<\HintPath> <HintPath>c:\temp\bin\Debug_MT<\HintPath>......... . thank you |
#6
|
|||
|
|||
I guess you're doing something like
http://www.kinook.com/Forum/showthre...?threadid=4076 but using $(ConfigurationName) rather than $(OutDir)? Those types of macros/variables are resolved by Visual Studio, not by VBP. They will not be replaced by an actual configuration name in the project file, but will instead be interpreted and converted by VS when building the project. When using an expression like that in the replacement field of the Replace in File action, you need to escape the parentheses (see the attachment in the link above): $\(ConfigurationName\) |
|
|