Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:25:23+00:00 2026-06-11T23:25:23+00:00

using System; using System.Collections.Generic; using System.Text; using Shapes; namespace ShapeUser { public class ShapeUser

  • 0
using System;
using System.Collections.Generic;
using System.Text;
using Shapes;

namespace ShapeUser
{
    public class ShapeUser
    {
        public static void Main() 
        {
            Circle c = new Circle(1.0F);
            Console.WriteLine("Area of Circle(1.0) is {0}", c.Area());
            Console.ReadKey(); // press a key to exit program
        }
    }
}

This program is using Shapes assembly which is in the GAC. If there is only one assembly, its fine. But, the GAC may contain other assemblies with the same name (but different version and key).

So, how to tell the CLR to load my assembly only not the others having same name?

I’m confused. I know it is protected by public key encryption but still we should be having some private key in the program from where we are accessing it. Please clear my confusion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:25:24+00:00Added an answer on June 11, 2026 at 11:25 pm

    When you reference an assembly in the GAC you must reference it by its strong name, a combination of its name, version number, culture (if provided) plus a public key and digital signature (assemblies must be signed to be considered strongly named, and only strongly named assemblies may be added to the GAC).

    If you reference a strongly named assembly then you are already uniquely identifying what assembly you wish to use. If you are referencing an assembly that isn’t strongly named then that assembly can’t be loaded into the GAC (and the .Net runtime won’t check there anyway, see How the Runtime Locates Assemblies).

    If you are referencing a strongly named assembly (or in fact any assembly) and want to accept multiple different versions of that assembly (e.g. v1.0.0.0 and v1.0.1.0), or you want to release a newer version of your assembly and allow existing applications to continue functioning without needing to be recompiled then you can use Assembly Binding Redirection.

    If you want to be able to reference an assembly regardless of what key is used to sign that assembly then you are best off not signing that assembly at all (and therefore not adding it to the GAC).

    I believe that you can also subscribe to the assembly resolve event, however using assembly binding redirection is the preferred method, as long as it provides the desired behaviour.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EfTestFactory { public abstract class
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace as2 { class
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Threading; namespace ClassLibrary { public
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program {
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenericCount { class Program {
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program {
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program {
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Assignment2 { class Program {
C#: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.