简体   繁体   中英

How to deploy a console application

I have a console application, that when I run (from within vs.net) it takes a while as it is a long running process.

I want to continue coding in vs.net, and maybe even spawn multiple instances of the console application.

How to best deploy this on my desktop cmputer?

Is this a good approach:

create a folder: /myConsole/ then subfolders for each instance.

Do I just grab all fines in the /debug folder or are there other dependancies?

If you run without attaching the debugger you can continue coding while the program runs.

Debug Menu | Start without debugging, or Ctrl+F5

Note: using this method, you can compile the modified code, but cannot run it since the .exe output file will be in use. I'm not sure if that's a problem for you.

One way I've done it before is to create a release build from VS. Then open as many command prompts as you need on the release folder and then run it from there. Then I change back to debug build and continue coding. This lets me run the separate instances and also debug if need be and it's all as simple as changing the type of build in VS.

You should consider executing your code through system tests in a unit test console like the one that Resharper offers. It does shadow copying for you and allows you to nicely run multiple sessions, start/abort them etc. I think this is far more clean and flexible than firing up test apps all over the shop.

If you dont need to have the debbuger attach, what about just going to your /bin folder and double clinking on the exe, as many times as instances you want open?

If you DO need to have the debugger attached.. then the only way I can think about it is to have multiple instances of VS running, each with the debugging on :S

In general, there aren't any dependencies outside of your bin\\debug directory. If you want to test this long-running program while you're still coding and re-compiling, you'll want to copy the contents of the bin\\debug directory somewhere else, and run it from there.

Whether or not you can run separate instances from the same directory depends on how the program deals with output files or other resources. If the name of any output file is hard coded, then you'll have to run multiple instances from separate directories. If you can specify files on the command line, then you can run as many instances as you like from within a single directory.

You should be able to copy your console application into a separate folder. This would be all the files in the build folder. Then, you can just run it like any other exe. If you are not sharing settings / data in the application folder, you can run the application as many times as you like. Windows is quite happy to run a number of instances of the same exe.

If you wanted to automate, you could copy the application out of the build folder in a build event...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM