.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Shared Assembly in C#.net

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
i have craeted a shared library using C#.net and sign the assembly with a strong key.After that i have deployed the assembly into the GAC(C:\windows\Assembly\), and i have located the assembly while browsing the folder.But when i am trying to load the assembly in the sample application using Addreference procedure i cant able to locate the assembly in the above mention folder.. But actually its there in it.I didnt know the problem exactly.so help me in this..

View Complete Post

More Related Resource Links

MVC2 Could not load file or assembly 'xxxx.Models' shared hosting

Hello,I have an mvc2 site that runs fine locally but when i deploy it to my shared hosting account i keep getting this error.Could not load file or assembly 'AppMVC2.Models, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.I have run Reflector againts the dll to see what dependencies the dll has, I then took each one of the dependant dlls and set them to copy local in the project and deployed them all to the shared hosting account even ones that should be on the server like System.Web. except for mscorlib.dll, but i still get the error.I have also tried to bin deploy and deploy the code files and get the same error.I have seen people write about fusion log but i don't see any examples on how to get this running on shared hosting.Just wondering does anyone else have any recommendations on how to track down the source of this problem?

SvcUtil-generated code or shared interface/data contract assembly?

If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

.NET error Request for the permission of type securityPermission for shared assembly on network


      We have following error while running one of .net assembly from our COM application.

Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

The COM application built on mixed mode with .NET2.0 and VC++2008 and runs on various enviroments. but at
customer production fails with above error. Tried with different settings and CASPOL commands below but
still we get errors when running from SHARED drive

-Registered with regasm C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>regasm /codebase \\Machinexxx\folder1\\bin\Validation.dll

-Gave full trust to assemblies from .net configuration manager.
- caspol.exe -quiet -machine -addgroup All_Code -url "\\machine-xx01\folder1\Bin\*" LocalIntranet
- caspol.exe -m -ag LocalIntranet_Zone -url "\\machine-xx01\folder1\Bin\*" FullTrust –n FullTrustshare
after various caspol commands, which were successful, we did restart machine, but still when running
the application with that DLL it will throw above security error.

Any p

Load an assembly from a shared location does not work


Hi there,

I have few websites that are using the same business logic layer which changes quite often. Therefore I would like the business layer assembly to be in a shared location.

I want to be able to set the location in the config (and not install the dll in the GAC).

I followed the steps of method 2 in: http://support.microsoft.com/kb/837908/en-us

my web.config looks like:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="CoreLib.Models

System.IO.FileLoadException thrown while loading assembly from shared location



I am facing an issue related to .NET Reflection in Windows application.
I have 3 machines.

In Machine1 I have placed dot net assemblies(dll) (build with 1.1 framework) and shared(folder) for read access.
In machine 2 I am trying to load the Assembly (dll) from shared location of Machine1.

i.e.  Assembly FileAssembly = Assembly.LoadFrom(\\\....somelib.dll);

I am getting an exception as below

  System.IO.FileLoadException was caught
  Message="Could not load file or assembly ,..., Version=1.0.3310.15019, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
  FileName="..., Version=1.0.3310.15019, Culture=neutral, PublicKeyToken=null"
       at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
       at System.Reflection.Assembly.

Error: Encountered multiple versions of the same assembly with GUID...try pre-importing...TlbImp


Hi!  Can someone tell me how I can troubleshoot the following error: "Encountered multiple versions of the same assembly with GUID...try pre-importing one of these assemblies".

The website developed in VS 2010 (.Net 3.5). This error is only received on my workstation.  Another person developing the site does not experience this issue at all.  Also, not sure if this matters, but on my workstation the 'Assembly Information...' dialog contains no values even though the 'AssemblyInfo.vb' file does specify values for the title, desc, etc.  The GUID being referenced in the error is the main project of the three projects within the solution.

I tried looking through the GAC, but do not see any references to the projects or DLLs in the VS solution and am not sure what else/where to look.

If I delete the copy of the solution on my local machine and pull down a copy from source control (AnkhSVN) the solution will build with no error.  Once I make any changes, such as adding a new aspx file, then the error is received.

I can provide any additional information needed.

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


MySql.Data assembly problem



I added refernece MySql.Data to my project. My web.config looks like that:

<?xml version="1.0"?>
                <add assembly="MySql.Data, Version=, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>

But when in ServerExplorer I try "Add Connection..." I can't find "MySql Database" in the "Choose Data Source" dialog box?

What the problem can be?

Public Shared function doubt????

I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.


Registering controls of current assembly object reference NOT set error


Hi There,

I have created a simple ASP.net Web Application (2.0) and have added a web user control.

Now in my page I have added this control but I have registered like this,

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>

Which means I want to access all the controls in my current Web Application project

Then I have added my user control like this,

<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />

Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"

Note that My Control has,

1) Public property PublicProperty as String

2) 1 Label control

In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).

I don't want to register my control using Src, TagPrefix etc. Any ideas?


Could not load file or assembly - Web Deployment Project



I have the following projects in a solution :

- A Web Application

- A Class Library

- A Web Deployment project

The Web Application compiles and run fine when I don't go through the Web Deployment Project. However when I try to use that, I get the following error:

Error 1 An error occurred creating the configuration section handler for hibernate-configuration: Could not load file or assembly 'NHibernate' or one of its dependencies. The system cannot find the file specified. (F:\Folke\Folke.csproj_deploy\Release\web.config line 4) 1 1 Folke.csproj_deploy

"An error occurred creating the configuration section handler for hibernate-configuration: Could not load file or assembly 'NHibernate' or one of its dependencies. The system cannot find the file specified. (F:\Folke\Folke.csproj_deploy\Release\web.config line 4)"

This is the beginning of my Web.config:


CLR Inside Out: Migrating an APTCA Assembly to the .NET Framework 4


The CLR security model in the Microsoft .NET Framework 4 has undergone some substantial changes, including the adoption of "Level2" transparency, similar to the Silverlight security model. Mike Rousos provides an in-depth explanation of how that will likely impact authors of AllowPartiallyTrustedCallers (APTCA) libraries.

Mike Rousos

MSDN Magazine March 2010

Test Run: Determining .NET Assembly and Method References


Before you can test any software system effectively, you must understand the system under test. If the system includes the Microsoft® . NET Framework, understanding the system under test includes understanding its assembly and method dependencies.

James McCaffrey

MSDN Magazine March 2006

Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET


With over 9,000 files, and including some 1300 public classes to pore through, the Shared Source CLI can teach you quite a bit about the internal workings of the CLR. But the sheer amount of source code included can make just starting your exploration a monumental task. This article discusses some of the things you can learn from the source code facsimile of the CLR, like how JIT compilation works. It will also help you understand how to control execution along with debugging and loading classes. A walk through the steps involved in setting up the runtime will let you become familiar with the process.

Jason Whittington

MSDN Magazine July 2002

External Assembly for Controllers...


I am just learning MVC, so bear with me.

I would like to have a project that contains all of my Controller logic. I'm not concerned with using Areas, as these are still maintained within the same project. 

Consider this scenario:

I have multiple sites/apps that require the exact same interaction in regards to a particular area, say CRUD ops on a user account. I do not want to create all of the controller logic for one site/app, recreate it again for the next, and make sure that I keep all maintenance to each in sync. I would prefer to keep the controllers in a separate project and reference them from the appropriate site.

I know someone will say that the controller logic is a lot of times specific to the application (as I've read elsewhere), but let's just say that it is guaranteed to be the same. I want to focus on the "how" and not the "why".

So far, I've created a class library project with the appropriate references for accessing System.Web.Mvc. How do I proceed with the routing configuration for this? Is this idea even possible? I read a few older articles that were written when Areas were first being introduced that said to create separate projects for them. Is this idea similar to that?

Thanks for your time and noob tolerance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend