References embedding

  • Thread starter Thread starter Tamir Khason
  • Start date Start date
T

Tamir Khason

Following the scenario:
client want the application in ONE file only and do not want to hear about
more then one exe in directory.
The application is about 10 projects (no other way to build 'cos consist of
3d parties without sources)
So thinking about folloing scenarion:
1) Make base class to embedd in it all classes in the application
2) On running such class (run-time - not installation) unpack all files into
temporary directory
3) On exit run Mr. Clean.

This is VERY DURTY AND UGLY solution, BUT I do not know another way... So
Maybe You do???

Please advice...
 
Probably the best solution, but very very messy. It would require late
binding and a lot of deleting. Also maybe difficult because once you bind
it, you cant unbind it, so in a lot of situations you would get access
violations trying to delete the assemblies. It is not exactly the same, but
maybe if your client would allow it, have all of the assemblies reside on one
server. Have one executable that can be copied/moved anywhere and use
remoting or even just load the assemblies over the network. That is if all
computers are on the same network.
 
landagen said:
Probably the best solution, but very very messy. It would require late
binding and a lot of deleting. Also maybe difficult because once you bind
it, you cant unbind it, so in a lot of situations you would get access
violations trying to delete the assemblies. It is not exactly the same, but
maybe if your client would allow it, have all of the assemblies reside on one
server. Have one executable that can be copied/moved anywhere and use
remoting or even just load the assemblies over the network. That is if all
computers are on the same network.

You could also embed all the assemblies into an exe as a binary
resource streams and use the Assembly.Load(byte[]). You could do this
in response to the AppDomain.CurrentDomain.AssemblyResolve event to
find and load the appropriate resource stream or you could create an
entirely seperate exe whose sole purpose is to load the assemblies
from its resource stream and invoke entry point of your exe (now also
embeded in the resource stream) allowing you to completely seperate
this packaging concern from the project itself. In either case since
all assemblies would be directly loaded into memory no cleanup needs
to be done on exit or left over files if the program crashes/power
outage or whatever.

I did a quick google search and found some sample code for you too at:
http://weblogs.asp.net/jdennany/archive/2003/09/24/29035.aspx

- Kurt
 
Dynamic assemblies will have issues with some things (say, XML
serialization).

--
Michael Giagnocavo
MVP
www.atrevido.net

Kurt said:
landagen said:
Probably the best solution, but very very messy. It would require late
binding and a lot of deleting. Also maybe difficult because once you
bind
it, you cant unbind it, so in a lot of situations you would get access
violations trying to delete the assemblies. It is not exactly the same,
but
maybe if your client would allow it, have all of the assemblies reside on
one
server. Have one executable that can be copied/moved anywhere and use
remoting or even just load the assemblies over the network. That is if
all
computers are on the same network.

You could also embed all the assemblies into an exe as a binary
resource streams and use the Assembly.Load(byte[]). You could do this
in response to the AppDomain.CurrentDomain.AssemblyResolve event to
find and load the appropriate resource stream or you could create an
entirely seperate exe whose sole purpose is to load the assemblies
from its resource stream and invoke entry point of your exe (now also
embeded in the resource stream) allowing you to completely seperate
this packaging concern from the project itself. In either case since
all assemblies would be directly loaded into memory no cleanup needs
to be done on exit or left over files if the program crashes/power
outage or whatever.

I did a quick google search and found some sample code for you too at:
http://weblogs.asp.net/jdennany/archive/2003/09/24/29035.aspx

- Kurt
 
Back
Top