Could not load file or assembly '' or one of its dependencies

后端 未结 9 1477
遇见更好的自我
遇见更好的自我 2020-12-16 13:34

Any help please?

I have only one library and it is driving me crazy. this is the error that I receive. I am not using any other dependancies.

Could n         


        
相关标签:
9条回答
  • 2020-12-16 13:48
    • Does the version number match?
    • It's weird to see you're trying to load a .lib file instead of a dll. Perhaps you wanted to load a dll instead?
    • To debug this kind of problems, try Fusion Logging
    • You say you're using only one library, but that library might have some dependencies you're not aware of. This SO question deals with listing the dependencies of a managed .NET assembly.
    0 讨论(0)
  • 2020-12-16 13:51

    To make Visual Studio adding 3rd party assembly or even your own assembly from other project in solution to GAC please do next:

    1. Open Package.package from Package folder in SharePoint project.

    2. Click Advanced in bottom area.

    3. Click Add and chose which type of assembly you want to add.

    4. In dialog select dll file, chec GAC or BIN, add safe controls and class resources entries if required. Click Ok.

    Your assembly will be packaged to WSP, defined in manifest and deployed everytime.

    0 讨论(0)
  • 2020-12-16 13:51

    Please try to unreference the DLL then re reference it again and rebuild you project. Also Check to ensure that the version matchs what is in the project web config

    0 讨论(0)
  • 2020-12-16 13:55

    For assemblies not in GAC, and which are referred in the build, sometimes this error also happens if the platform target does not match. So match the assembly platform type to the one where it is being used.

    0 讨论(0)
  • 2020-12-16 13:56

    Problem Solved!

    I thought that Visual Studio was copying the DLL in to the GAC, but apparently not. So I copied it there manually and it works.

    One question though, is this normal that visual studio does not copy it to the GAC when I deploy the sharepoint application?

    For those who would like to know how to copy the dll to GAC

    there are two ways to copy the dll to GAC:

    1. copy the dll manually

      1. Open c:\windows\assembly directory in windows explorer
      2. Open another instance of windows explorer and go to the place where your dll is located, usually in the bin folder. (so now you will have two windows open)
      3. select the dll you would like to copy to gac and drag it inside the assembly directory, c:\windows\assembly
    2. use VS to deploy it for you to GAC.

      1. in your sharepoint project double click on "Package".
      2. Package.Package will open. Look bottom left of your screen and click on "Advanced",
      3. then click on "Add", then select "Add Assembly from project output...".
      4. In the Source project dropdownlist select the project and then click OK.
      5. finally deploy the solution and the dll will be in the GAC.

    thank you for your support.

    0 讨论(0)
  • 2020-12-16 14:01

    If error is when publishing in Visual Studio 2012 un-check the "Precompile during publishing" option in the publish wizard and try again.

    Un-check the "Precompile during publishing" box

    0 讨论(0)
提交回复
热议问题