.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

Assembly dependency loading

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :.NET Framework
I have a VSTO addin that I want to add a plugin loading mechanism to.  I publish the addin to a location on my hard drive, with the plugins in a separate folder.  I load plugins from assemblies using Assembly.LoadFile().  The plugins folder is outside of the AppDomain ApplicationBase. One of the plugins depends on a COM object, and Visual Studio automatically generates an interop assembly for the COM object.  But when I try to use that plugin, I get an exception saying that the interop assembly cannot be found.  It is in the plugins folder, along with the plugin assembly itself. I tried adding the plugin directory to the PrivateBinPath, but since it is outside the ApplicationBase, this is ignored.  It works if I put the interop assembly in the folder where the published VSTO addin is, but don't see that as a solution as it requires manually moving DLLs around each time things get rebuilt. Is there some way of telling the framework where to look for the dependency?  Or even of loading the dependency explicitly?  Since the dependency is also a .dll in the plugins folder, my plug-in loader attempts an Assembly.LoadFile on it, but this doesn't seem to help the framework to resolve the dependency when I try to use the plugin.

View Complete Post

More Related Resource Links

Error loading an assembly in VS 2010


Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\0385538b\d249bb9e\App_global.asax.nfwopg19.dll' or one of its dependencies. The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\0385538b\d249bb9e\App_global.asax.nfwopg19.dll' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The followin

SPPersistedObject and assembly version dependency

Hi All, I have implemented some SharePoint solution that uses SPPersistedObject-s, this solution has some DLL files which are versioned. So the problem is that when the DLL version changes, I can't see those object that were written with an old DLL version anymore, SPPersistedObject objects are the same(structure, etc ...) and they are still there, because if I add an old version back this objects are still there and I'm able to read it. Any suggestions, how this can "limitation" can be avoided? Any workaround? Any proper solution?   Best Regards and  Thank You, Mitja

VS2008 WPF Xaml: Is there a path length limit when loading an assembly?



It seems that there is a path lenght limit for VS2008 when loading XAML assemblies.

Using the Microsoft sample Southridge, if the project is stored on "C:\Projects\C# samples\Southridge_Labs\1.Southridge_Fundamentals\Start" the designer does not load the assemblies.

But if I copy my files the project to the root (C:\Southridge_Labs\1.Southridge_Fundamentals\Start) then it works fine.

Basically I have solved my problem, but I want to know if there is an EXPLICIT limit and I cannot find any information related.

Thanks for your help.

XAML WPF assembly not loading into designer


Win 7, VS 2008 SP1, .NET 3.5 Sp1

I have an error on my machine only, but has no complaints on other similar machines. I have a separate xaml file in my local assembly, so I make the declaration in my main XAML file :

A local type xaml is used (in a grid) and is in the body of the main xaml file :
<local:PLTButtonPanel x:Name="BtnPanel" HorizontalAlignment="Left" VerticalAlignment="Top" .....MORE STUFF..../>

This error is displayed when trying to load the designer :
Error 1 Assembly 'MyAppName' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built. H:\usr\src\CS\MyAppName\MyAppName\MainFrameWindow.xaml 6
Error 2 The type 'local:PLTButtonPanel' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. H:\usr\src\CS\MyAppName\MyAppName\MainFrameWindow.xaml 220

When I compile, the erros go away, the app runs fine, BUT the Designer never loads the UI into view. It has no problem on ther identically configured machines.

Any ideas what is not set properly ?

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.

Dependency Properties

When you begin to develop appliations with WPF, you will soon stumble across DependencyProperties. They look quite similar to normal .NET properties, but the concept behind is much more complex and powerful

JQGrid Loading deleted values



This is quite strange. here is the issue:

Some Info:

1. I'm using a multi-select jqgrid.

2. I have my own delete button to delete multiple orders

The problem:

When i press the delete button on the pager of my jqgrid, the records are deleted from the database but JqGrid shows some records (4-5). On refreshing the grid, correct numbers of records are shown.

Here is the code:

function delorder() {
        var amg = $("#horder").getGridParam('selarrrow');
        var cont = amg.length;
        if (amg.length > 0) {

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?

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:


On page loading or executing all CSS flags are ignored and website is plain without formatting


 My problem is whenever i execute my app the first page that loads is the login page pointed to by my web.config file forms authentication, this page is meant to show CSS formatting for the info i am displaying but it is not. Any help with this problem would be great. A cut and paste of my problem is shown below as you can see there is no CSS.

jsfdnjldfngjfg here it is

Account Login
User Id:
Forgot Password?

I have inserted all the link as in:




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

Inside Microsoft patterns & practices: Dependency Injection in Libraries


This article discusses how to write a library or framework that uses the Dependency Injection pattern and how the change in focus affects the usage of the pattern.

Chris Tavares

MSDN Magazine November 2009

Foundations: Dependency Properties And Notifications


Windows Presentation Foundation dependency properties don't always play well with others. Learn how you can compensate for their lack of notification events.

Charles Petzold

MSDN Magazine September 2008

Foundations: Loading Workflow Models in WF


When building workflows, you must consider the developer experience, available tools, long-term maintenance, and future versioning.

Matt Milner

MSDN Magazine May 2008

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