Stackoverflow answers the question but source code is not there (yet) http://stackoverflow.com/questions/878598/how-to-detect-net-application-type
<http://stackoverflow.com/questions/878598/how-to-detect-net-application-type> .peter.gfader. http://blog.gfader.com/ http://twitter.com/peitor On Mon, May 17, 2010 at 10:02 PM, Peter Gfader <[email protected]>wrote: > One way could be, to get all current loaded assemblies, and check if there > is more System.Web.X loaded than System.Windows.Forms.X or some other weird > switches... > > But I would HIGHLY avoid to have different behaviour, depending from the > environment where your library lives in. > > to get started look for > > AppDomain.CurrentDomain.GetAssemblies() > http://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies.aspx > and > Assembly.GetEntryAssembly > > http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getentryassembly.aspx > > .peter.gfader. > http://blog.gfader.com/ > http://twitter.com/peitor > > > On Mon, May 17, 2010 at 8:06 PM, Greg Keogh <[email protected]> wrote: > >> Folks, I have a library that is called from WinForms apps and from >> ASP.NET apps and it has to have slightly different behaviour in each >> case. What is the simplest and most robust way that the library can >> determine what sort of process it’s in? >> >> >> >> Greg >> > >
