Alex Gordon
Alex Gordon

Reputation: 60731

How to test a VS C# program on another computer

I would like either a command prompt solution or a Visual Studio 2008 solution for the following:

I am building a solution in Visual Studio 2008 C# and I need to test it.

In order to test the solution, I need to copy it to a different machine.

My process is:

  1. copy debug folder to shared location
  2. copy from the shared location onto the source machine

I try to do it like this:

rmdir s:\debug /s /q
s:
md debug
copy "C:\Documents and Settings\user123\Desktop\eFormsSystem\eFormsApp\bin\Debug\*.*" s:\debug\

however it is saying that THE SYSTEM CANNOT FIND THE PATH SPECIFIED.

I am certain there is a problem with the code above; however I would like to know:

  1. Is there a way to do this using Visual Studio? I would want it to copy the debug directory into a shared location as soon as there is a build.
  2. If command prompt is better suited for this, can you please tell me what is wrong with my code above?

Upvotes: 0

Views: 575

Answers (2)

noxsoul
noxsoul

Reputation: 66

There are two things you can try. First is try using the switches on the copy command like you did for the rmdir command. Try adding the /Y and /Z switches.

  • /Y = Suppresses prompting to confirm you want to overwrite an existing destination file.
  • /Z = Copies networked files in restartable mode.

May just want to try this first. I know the /Y is redundant since you are removing the destination directory before copying.

copy "C:\Documents and Settings\user123\Desktop\eFormsSystem\eFormsApp\bin\Debug\*.*" s:\debug\ /Z /Y

Secondly, you asked if you could do this from Visual Studio. You could use the post-build event on the project to copy files to another location on the network after a successful build. However, you first need to get the command working.

Upvotes: 1

JoshL
JoshL

Reputation: 10988

Your statements appear to be correct, and I tested that they work fine given a project that I have on my local machine. Is it possible that the user that you're running the statements from does not have permission to read from the folder in your "copy" statement? You can verify this by substituting the following for the copy line - ensure that it responds with a list of the files that you're intending to copy:

dir "C:\Documents and Settings\user123\Desktop\eFormsSystem\eFormsApp\bin\Debug"

Note that from within Visual Studio, you can add a "Post Build Event". Go to the Properties of your Project in Visual Studio (right-click on the Project and choose Properties). Then click the Build Events tab - on that tab you can enter command-line statements to run before and after the project is built. Click "Edit Post-build..." to bring up a window with Macros that you can insert into your script including things like "OutDir" which is the directory that the project output is written to.

Upvotes: 1

Related Questions