Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] Third Party Tools
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1  
Old 11-19-2004, 12:55 PM
joes joes is online now
Registered User
 
Join Date: 11-17-2004
Posts: 13
csproj file containing "&" in a PreBuildEvent step fails to parse

In a csproj file I have a line like this:

PreBuildEvent = 'cd $(ProjectDir) & "$(DevEnvDir)\..\..\Vc7\Bin\nmake"'


When I try to build the solution containing this csproj file under Visual Build Pro I get this error:

Error loading info for project file 'C:\Foo.csproj': An error occurred while parsing EntityName. Line 19, position 52.

The character at position 52 is the "&".

Is there a way to change the PreBuildEvent command so both Visual Studio and Visual Build accept it?
Reply With Quote
  #2  
Old 11-19-2004, 01:34 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
VBP's Make VS.NET action uses the .NET XML parser to process VS.NET project files, so it requires the files to be valid XML. Oddly, VS.NET 2002/2003 doesn't create a valid XML file when there is an ampersand char in a build event, and it also doesn't parse a correctly encoded ampersand char if the file is converted to valid XML.

The simplest workaround is to put your build event commands on multiple lines instead of using &. If you click the ... button beside the event command line field, you can enter commands on multiple lines using Enter. VS.NET does appear to encode the cr/lf chars properly.
Reply With Quote
  #3  
Old 11-19-2004, 01:53 PM
joes joes is online now
Registered User
 
Join Date: 11-17-2004
Posts: 13
I'm not sure VS does encode multiple lines correctly:

PreBuildEvent = 'cd $(ProjectDir) {amp pound xd; amp pound xa;}* "$(DevEnvDir)\..\..\Vc7\Bin\nmake"'

is what I get when I specifiy the commands on multiple lines in the VS GUI.

I tried replacing the original "&" using the VBPro command "replace in file" right before I build the VS solution. However, it looks like VBPro doesn't use the modified file as the step to build the solution fails.

(*the actual characters wouldn't show up in this message so I had to use the full words. Sorry if this is confusing)

Last edited by joes; 11-19-2004 at 01:58 PM.
Reply With Quote
  #4  
Old 11-19-2004, 02:25 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Using VS.NET 2003, putting the commands on multiple lines in the build event, I was able to build in VS.NET or VBP. The newline was written as




which is valid XML.
Reply With Quote
  #5  
Old 11-19-2004, 04:14 PM
joes joes is online now
Registered User
 
Join Date: 11-17-2004
Posts: 13
That is exactly what gets put in my file when I break the command up into two lines. VBPro in my environment doesn't like it for some reason. I must be doing something wrong.

I've tried moving the commands to a bat file and calling it from VS and VBPro and that works. I think I'll just go with that solution.
Reply With Quote
  #6  
Old 11-19-2004, 06:31 PM
joes joes is online now
Registered User
 
Join Date: 11-17-2004
Posts: 13
I tried again and I did get the "split line command" to work. I've been hacking the bld file together and I guess some stale state was building up. I created a fresh build step and it works now.
Thanks for the help.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 08:10 PM.


Copyright © 1999-2023 Kinook Software, Inc.