mercredi 16 avril 2014

.net - DLL c# dépend d'une autre dll - Stack Overflow


I'm making a project with Microsoft Visual Studio 2010 and C#. With this project I want to generate a .dll.


In my project I have an external reference to itextsharp.dll and this give me an error when I try to use myproject.dll on another computer it gives me an error:



Can't load file or assembly itextsharp...



So, anyone knows how can I solve this?




Just copy itextsharp.dll to the same folder as myproject.dll


Also this can be automated by setting "Local Copy" property of to "true". So after each rebuild Visual Studio will automatically copy the .dll-file for you near to all compiled dll/exe files of current project..




If you add a dll in your project, that is not a Microsoft build in .dll, you must copy/paste this .dll with you Application. They must be together, because this .dll is searched from your Application in the current directory where the Application is.




Edit the web.config file to remove the reference, which is not required for normal operation:


1 - Open the web.config/app.config file in the root of your site


2 - Find the following line and comment it ():xxxxx-is your assembly name.


<add assembly="xxxxx", Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>3 - Save and close the web.config file and try again

Ref Link : http://manual.aspdotnetstorefront.com/p-1118-could-not-load-file-or-assembly-microsoftwebservices3-version3000-cultureneutral-publickeytoken31bf3856ad364e35.aspx


UPDATE :


The above is not working then you need to refer the itextsharp.dll in new project as well.The reason is.


itextsharp.dll--> level 0 (not depending on other dlls)
Myprojet.dll --> level 1 (depending on itextsharp.dll)
consuming App --> level 2 (depending on level 1 , level 2)


After build the consuming app you have to get the level 0,level 1 dlls in bin folders.So you have to add itextSharp.dll as a reference.



I'm making a project with Microsoft Visual Studio 2010 and C#. With this project I want to generate a .dll.


In my project I have an external reference to itextsharp.dll and this give me an error when I try to use myproject.dll on another computer it gives me an error:



Can't load file or assembly itextsharp...



So, anyone knows how can I solve this?



Just copy itextsharp.dll to the same folder as myproject.dll


Also this can be automated by setting "Local Copy" property of to "true". So after each rebuild Visual Studio will automatically copy the .dll-file for you near to all compiled dll/exe files of current project..



If you add a dll in your project, that is not a Microsoft build in .dll, you must copy/paste this .dll with you Application. They must be together, because this .dll is searched from your Application in the current directory where the Application is.



Edit the web.config file to remove the reference, which is not required for normal operation:


1 - Open the web.config/app.config file in the root of your site


2 - Find the following line and comment it ():xxxxx-is your assembly name.


<add assembly="xxxxx", Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>3 - Save and close the web.config file and try again

Ref Link : http://manual.aspdotnetstorefront.com/p-1118-could-not-load-file-or-assembly-microsoftwebservices3-version3000-cultureneutral-publickeytoken31bf3856ad364e35.aspx


UPDATE :


The above is not working then you need to refer the itextsharp.dll in new project as well.The reason is.


itextsharp.dll--> level 0 (not depending on other dlls)
Myprojet.dll --> level 1 (depending on itextsharp.dll)
consuming App --> level 2 (depending on level 1 , level 2)


After build the consuming app you have to get the level 0,level 1 dlls in bin folders.So you have to add itextSharp.dll as a reference.


0 commentaires:

Enregistrer un commentaire