Relative path running a windows batch

714 views
Skip to first unread message

nietzsche44

unread,
Aug 20, 2012, 10:27:00 AM8/20/12
to jenkins...@googlegroups.com
Hi, 

I am using Jenkins to build a C# project that includes a postbuild event that copies a file using a relative path: 

copy $(TargetPath) $(SolutionDir)..\CustomFolder\ 

But the copy fails because of the relative path ..\ 
I've made some tests executing a simple Windows batch command using relative path to copy a file, for example, and it doesn't work either. 

Could you give me a hint to solve this?? 

Thanx 

Slide

unread,
Aug 20, 2012, 10:58:34 AM8/20/12
to jenkins...@googlegroups.com
What happens if you build using devenv.exe instead of msbuild.exe?

Thanks,

slide
--
Website: http://earl-of-code.com

nietzsche44

unread,
Aug 20, 2012, 11:35:42 AM8/20/12
to jenkins...@googlegroups.com
Hi slide,

Thanks for the answer. I am not sure about what you mean using devenv to build, as far as I know, using devenv in a command line opens the project/solution in a visual studio window.

Thank you very much

Slide

unread,
Aug 20, 2012, 11:50:32 AM8/20/12
to jenkins...@googlegroups.com

Qazwart

unread,
Aug 20, 2012, 6:17:08 PM8/20/12
to jenkins...@googlegroups.com, jenkins...@googlegroups.com
Are you using parentheses or curly braces? Depending where your specifying this, the environment variable need curly braces or even surrounded by percent signs.

Where are you specifying this copy command?

--
David Weintraub
Da...@Weintraub.name

nietzsche44

unread,
Aug 21, 2012, 10:02:58 AM8/21/12
to jenkins...@googlegroups.com
Sorry slide I wasn't aware of that possibility, the problem is that I have not Visual Studio installed in the server.
 
David I am specifying the command in Visual Studio (the server downloads the code from the repository) in the tab Build Events, Post-Build event command line textbox.
 
Thank you very much

Alex Earl

unread,
Aug 21, 2012, 10:25:52 AM8/21/12
to nietzsche44, jenkins...@googlegroups.com
How are you specifying your build? Are you passing an sln file to msbuild? If not, I am not sure msbuild will set the SolutionDir variable.

Sent from my Windows Phone

From: nietzsche44
Sent: 8/21/2012 7:03 AM
To: jenkins...@googlegroups.com
Subject: Re: Relative path running a windows batch

nietzsche44

unread,
Aug 22, 2012, 6:49:03 AM8/22/12
to jenkins...@googlegroups.com, nietzsche44
Solved!!
 
Thats it, I am specifying the solution with the following command:
 
msbuild /p:Configuration=Debug /p:Platform="Any CPU" Test.sln
 
Finally the solution was easy, just add double quotes to the copy command, the problem was that when at the beginning I tried that the same problem occurred again but with another project with a similar name, so I got them mixed and thought it was not the solution,  I am sorry for bothering you.
 
copy "$(TargetPath)" "$(SolutionDir)..\CustomFolder\"
 
Thank you very much for your help.
Reply all
Reply to author
Forward
0 new messages