Quantcast

Relative path running a windows batch

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Relative path running a windows batch

nietzsche44
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 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

slide
What happens if you build using devenv.exe instead of msbuild.exe?

Thanks,

slide

On Mon, Aug 20, 2012 at 7:27 AM, nietzsche44 <[hidden email]> wrote:

> 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



--
Website: http://earl-of-code.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

nietzsche44
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

On Monday, August 20, 2012 4:58:34 PM UTC+2, slide wrote:
What happens if you build using devenv.exe instead of msbuild.exe?

Thanks,

slide

On Mon, Aug 20, 2012 at 7:27 AM, nietzsche44 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="sw0y79Yj1v4J">nietz...@...> wrote:

> 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



--
Website: http://earl-of-code.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

slide
Please see http://msdn.microsoft.com/en-us/library/b20w810z(v=vs.80).aspx

On Mon, Aug 20, 2012 at 8:35 AM, nietzsche44 <[hidden email]> wrote:

> 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
>
>
> On Monday, August 20, 2012 4:58:34 PM UTC+2, slide wrote:
>>
>> What happens if you build using devenv.exe instead of msbuild.exe?
>>
>> Thanks,
>>
>> slide
>>
>> On Mon, Aug 20, 2012 at 7:27 AM, nietzsche44 <[hidden email]> wrote:
>> > 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
>>
>>
>>
>> --
>> Website: http://earl-of-code.com



--
Website: http://earl-of-code.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

Qazwart-2
In reply to this post by nietzsche44
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
[hidden email]

On Aug 20, 2012, at 10:27 AM, nietzsche44 <[hidden email]> wrote:

> 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

nietzsche44
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Relative path running a windows batch

slide
In reply to this post by nietzsche44
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: [hidden email]
Subject: Re: Relative path running a windows batch

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Relative path running a windows batch

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.
 
 

El martes, 21 de agosto de 2012 16:25:52 UTC+2, slide escribió:
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: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="QPpAhfa80dcJ">jenkins...@googlegroups.com
Subject: Re: Relative path running a windows batch

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
Loading...