Post build events

  • Thread starter Thread starter Allan Ebdrup
  • Start date Start date
A

Allan Ebdrup

Hi
I'm Using VS.Net 2003 and am trying to get the app.config file copied to the
directory of the target dll by using a post build command.
In Properties/Common Properties/Build Events/Post-build Event Command Line
I've entered:
"copy $(ProjectDir)app.config $(TargetPath).config"

that should copy the app.config file to the target directory with the name
myDll.dll.config, but I keep getting the error: "Post-Build Event failed"
No more information is available

What am I doing wrong?

I've taken a look at:
http://msdn.microsoft.com/library/d...opertiesprojectnamepropertypagesdialogbox.asp
but as far as I can see my build event should be correct.

Kind Regards,
Allan Ebdrup
 
Hi,

What if you mark your app.config as content, IIRC it will be copied to the
target directory

also remember that if this is a dll project the config feature is not
available for dlls

cheers,
 
Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

What if you mark your app.config as content, IIRC it will be copied to the
target directory

also remember that if this is a dll project the config feature is not
available for dlls

It is a dll, as I also write. I'm trying to mimic the copying that occurs in
VS 2005, but as you can see I'm having problems. You'll have to read my post
again if you want to help me.

Kind Regards,
Allan Ebdrup
 
Hi Allan,



I use post build events rather often and I found that very often the file
paths contain spaces that confuses the copy command because it understands
the space as delimiter between command line arguments.



What you can do is to enclose the parameters in quotes (")



copy "$(ProjectDir)app.config" "$(TargetPath).config"



If it doesn't help (it should though) go to the application bin folder and
look for file called PostBuildEvent.bat. This what VS generates and executes
after compilation. You can open this file and you can try to run the copy
commands directly in command prompt. This may give you more descriptive
error message.




HTH

Stoitcho Goutsev (100) [C# MVP]
 
Stoitcho Goutsev (100) said:
I use post build events rather often and I found that very often the file
paths contain spaces that confuses the copy command because it understands
the space as delimiter between command line arguments.

What you can do is to enclose the parameters in quotes (")

copy "$(ProjectDir)app.config" "$(TargetPath).config"

Thanks, that worked!
 
Back
Top