views:

59

answers:

4

I want to develop a application including two execute files(one as main entry,the other as upgrader).

I'm wondering if the two execute files can be generated in a VS project ?

if can't,are there better way to develop the two execute files? and how to share some Model code?

thanks in advance!

+1  A: 

You can extract you models into a separate project and reference that from any other projects in the solution.

A project would be an executable or a dll full of classes (your model classes), and a solution can have any number of projects which can reference any of other projects in the solution as well as external .dll files.

To add a project to a solution just right mouse click the solution and select add new project. If you only have one project open in visual studio use the File menu to add a new project

This link might help

Dylan
A: 

You can just create to WinForm applications and a class library, so you would have:

  • Main Application (Windows Form App)
  • Upgarde Application (Windows Form App)
  • Common Module (Class Library)

Of course the Upgarde Application doesn't have to have a form, you could remove the form and just stick your code in Main()

Nathan W
A: 

You need at least three projects:

  1. Model code
  2. Standalone executable
  3. Upgrade executable

The exe project is normally a very thin bootstrapper that executes code in another assembly. This approach allows you to share code between different projects.

Igor Zevaka
Actually, .NET can load another .exe file as if it were a class library, so only two are needed. However, don't try to reference the main application from the upgrader, since the file would be in use and then could not be replaced.
Ben Voigt
thank you again.
blueslee
@Ben Voigt, Yes I am aware of that. It's just that it looks extremely awkward at deployment where one .exe will load another .exe.
Igor Zevaka
A: 

I get it. thank Igor Zevaka,Dylan and Nathan W very much.

blueslee
make sure you send upvotes peoples way and mark the correct answer.
Nathan W