Compile as exe and dll?

N

news.microsoft.com

Hello all,

I have a fairly complex solution that I will need to deploy as both a dll
and exe depending on the type of installation. Is there a way to automate
the build process so that a particular project in my solution can be built
as a dll and an exe.

Thanks in advance
Andrew
 
N

Nicholas Paldino [.NET/C# MVP]

Andrew,

No, I don't believe there is. However, in .NET 2.0, you will be able to
add references to executables (EXEs) as well as class libraries (DLLs). I
don't believe that this is a good thing though., as it corrupts design
greatly.

Rather, keep your logic in a DLL and then create a shell executable
which references the DLL for the functionality you require.

Hope this helps.
 
N

news.microsoft.com

Nicholas,

Thanks for the quick response. I hadn't though of creating a shell
executable.
I also agree that it really doesn't make sense to to add references to
executables.

Andrew

Nicholas Paldino said:
Andrew,

No, I don't believe there is. However, in .NET 2.0, you will be able to
add references to executables (EXEs) as well as class libraries (DLLs). I
don't believe that this is a good thing though., as it corrupts design
greatly.

Rather, keep your logic in a DLL and then create a shell executable
which references the DLL for the functionality you require.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

news.microsoft.com said:
Hello all,

I have a fairly complex solution that I will need to deploy as both a dll
and exe depending on the type of installation. Is there a way to automate
the build process so that a particular project in my solution can be built
as a dll and an exe.

Thanks in advance
Andrew
 
J

Jon Skeet [C# MVP]

I also agree that it really doesn't make sense to to add references to
executables.

I'm not sure that it doesn't, actually. Plug-in architectures spring to
mind: if I have a program with a plug-in interface, it makes sense to
me to have that interface in the executable, and compile the plug-ins
against the executable. Currently, using VS.NET, you have to have a
library which is probably only likely to be used for the interface.
 
B

Bonj

It is mainly the preserve of VB6, where it is done as 'ActiveX EXE'
projects, the thinking behind them being that you can isolate automation
compatible code into a separate process, so if it crashes, it doesn't bring
down the whole application. It is also the only way VB6 can implement
multithreading, so is often used by some people for that.

news.microsoft.com said:
Nicholas,

Thanks for the quick response. I hadn't though of creating a shell
executable.
I also agree that it really doesn't make sense to to add references to
executables.

Andrew

in
message news:[email protected]...
Andrew,

No, I don't believe there is. However, in .NET 2.0, you will be able to
add references to executables (EXEs) as well as class libraries (DLLs).
I
don't believe that this is a good thing though., as it corrupts design
greatly.

Rather, keep your logic in a DLL and then create a shell executable
which references the DLL for the functionality you require.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

news.microsoft.com said:
Hello all,

I have a fairly complex solution that I will need to deploy as both a dll
and exe depending on the type of installation. Is there a way to automate
the build process so that a particular project in my solution can be built
as a dll and an exe.

Thanks in advance
Andrew
 
W

William Stacey [MVP]

Possibly the best way to handle this is create most of code in a dll. And
also create a exe "wrapper" that will be a thin startup for the same dll.
If you want both console and windows versions of your app, you could create
console app as .com and windows version as .exe. Your console version could
also have a switch arg that starts the windows version by the same name
(with different extention.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top