473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

would you ever add a console app to the GAC?

D
I was toying around with assemblies, signing and adding them to the GAC. I
was mistakenly thinking that if I added a console app to the GAC it could be
run from anywhere (anywhere meaning as if the path to the exe was added to
your environment variables).

It then occurred to me that in order to utilize that I would need to write
another app that references the class (from the GAC). However the program
added to the GAC was a simple console hello world type so if I referenced it
from another app it would have to be like

using FirstTest;

Program p = new Program();
p.Main();

which should invoke the console app. I haven't tried it to figure out if it
would even work but then I was questioing whether you would ever need to add
an exe to the GAC.

Am I wrong?

Thanks

Oct 19 '06 #1
2 1716

D wrote:
I was toying around with assemblies, signing and adding them to the GAC. I
was mistakenly thinking that if I added a console app to the GAC it could be
run from anywhere (anywhere meaning as if the path to the exe was added to
your environment variables).

It then occurred to me that in order to utilize that I would need to write
another app that references the class (from the GAC). However the program
added to the GAC was a simple console hello world type so if I referenced it
from another app it would have to be like

using FirstTest;

Program p = new Program();
p.Main();

which should invoke the console app. I haven't tried it to figure out if it
would even work but then I was questioing whether you would ever need to add
an exe to the GAC.
I would never add an exe to the GAC.

If you want to put an executable on a network drive, for example, and
run it from any client machine, then I believe that the correct
solution is to sign it, and then use .NET security on all client
machines to indicate that applications with the signature in question
are fully trusted.

You could also fully trust the machine / folder where the application
is stored, but that leaves a potential security hole. (Anyone can place
any app in that folder and it will immediately become fully trusted.)

You _can_ sign EXEs and other things that you never intend to put in
the GAC, and security can be based on signatures, not just on presence
in the GAC.

The only thing the GAC is really good for (to my mind) is dealing with
side-by-side multiple versions of libraries. Where I work we don't
bother with the GAC because for us it adds no value. We are looking
into signing, however, for exactly the reason you outlined.

Oct 19 '06 #2
Well said. Only use the GAC if you're planning on releasing libraries
that will be used by other clients besides your own applications (like
a graphics library or custom controls) and you're planning on releasing
several iterations of the libraries as development progresses.

That being said, If you were making assemblies that exhibit
commandline-like behaviour and satisfied the above requirement, then it
could be done sensible. My approach would be to make a single
command-line app that takes an assembly-reference as an argument and
then fetches that assembly out of the GAC, checks to see if it
satisfies the command-line interface, and then passes the remaining
command-line arguments on to the assembly.... but I can't see that
being a very common situation unless you're (for example) implementing
the GNU tools for DotNet.

..... in that case, why not make them as EXEs? They'd never actually be
executed from the command-line, just done as EXEs since that is pretty
much the standard way to implement a command-line app.

Either way, this is all academic - I doubt any posters in this thread
are working on anything that justifies command-line stuff in the GAC.
Anybody porting Sed to dotnet?

Bruce Wood wrote:
D wrote:
I was toying around with assemblies, signing and adding them to the GAC. I
was mistakenly thinking that if I added a console app to the GAC it could be
run from anywhere (anywhere meaning as if the path to the exe was added to
your environment variables).

It then occurred to me that in order to utilize that I would need to write
another app that references the class (from the GAC). However the program
added to the GAC was a simple console hello world type so if I referenced it
from another app it would have to be like

using FirstTest;

Program p = new Program();
p.Main();

which should invoke the console app. I haven't tried it to figure out if it
would even work but then I was questioing whether you would ever need to add
an exe to the GAC.

I would never add an exe to the GAC.

If you want to put an executable on a network drive, for example, and
run it from any client machine, then I believe that the correct
solution is to sign it, and then use .NET security on all client
machines to indicate that applications with the signature in question
are fully trusted.

You could also fully trust the machine / folder where the application
is stored, but that leaves a potential security hole. (Anyone can place
any app in that folder and it will immediately become fully trusted.)

You _can_ sign EXEs and other things that you never intend to put in
the GAC, and security can be based on signatures, not just on presence
in the GAC.

The only thing the GAC is really good for (to my mind) is dealing with
side-by-side multiple versions of libraries. Where I work we don't
bother with the GAC because for us it adds no value. We are looking
into signing, however, for exactly the reason you outlined.
Oct 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: shawnk | last post by:
Hello Everyone How do you format format numbers right-justified using Console.WriteLine(), i.e I need to line up numbers in vertical columns and the MSDN documentation is pretty poor Here is the...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
5
by: Publicjoe | last post by:
I am working on a little app which uses colour in the console window. I have created a class to extend the console functionality but the ClearScreen method does not work correctly. I am enclosing a...
0
by: Glich via DotNetMonster.com | last post by:
#using <mscorlib.dll> #using <System.dll> #include "stdlib.h" #include "stdio.h" using namespace System; using namespace System::Text; using namespace System::IO; using namespace...
24
by: CJ Taylor | last post by:
Cmon.. I help out. =)
5
by: portroe | last post by:
Hi I am using console.Writeline in my simple program. I do not however see anything happening in the output window when I debug, there are also no error messages, Has anybody a tip on what...
3
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert...
5
by: gel | last post by:
Hi I have written a python client server app that keeps an eye on processes starting and ending on a client and makes decision on what to do based on information from the server end. I want to...
1
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.