I am trying to use ClosedXML to produce excel documents within an application, however, Whenevet I try to run it I receive a could not load file or assembly server error.
This is my form application
This is my Package
and this is my error when I click the import file button
error
Since you're developing for SharePoint, all used assemblies need to be strongly-named. They are deployed in the GAC, which is only possible for signed assemblies.
More info in this post: https://sharepoint.stackexchange.com/questions/62242/gac-and-signing-assembly-with-strong-name
You can change the NuGet reference to be ClosedXml.Signed, the signed version of ClosedXml.
Related
I have created a .NET Framework 4.7.2 website with a WCF service. To expose data through this service, I have to reference a third party DLL with Copy Local = False from C:\InstallLocation. The website is loading this DLL at runtime, but I get an error when accessing functionality in the DLL that requires it to load a secondary DLL in the same InstallLocation folder. I verified with Process Monitor that W3WP.exe is finding the primary DLL at C:\InstallLocation, but that W3WP.exe fails to look in C:\InstallLocation at all for the secondary DLL. The application error is the expected,
Could not load file or assembly '[assembly-info-ommitted]' or one of its dependencies. The system cannot find the file specified.
I also tested the exact same type of reference in a Console Application which worked without issue. Process Monitor showed the executable looking in C:\InstallLocation for the secondary DLL.
Is there a way to configure the .NET web app to allow the process to look in the same directory as the referenced, primary DLL? I have tried the following without (full) success:
Adding C:\InstallLocation to my system Path (and restarted). Seemed to have no affect. I verified on application start that the added path did appear in Environment.GetEnvironmentVariable("PATH").
Moved C:\InstallLocation into my web root and tried <probing privatePath="CopiedLocation". This got past the initial DLL reference issues, but still showed an error but on a different dependency for a different DLL. I don't think this will be a viable workaround.
Movied C:\InstallLocation to the bin folder and commented out . Same result as the above.
Gave the app pool user full permission to C:\InstallLocation. Users: IIS APPPOOL\{web site name}, IUSR, IIS_IUSRS
Edit
I have implemented an initializer as shown here, https://stackoverflow.com/a/16867088/2544926. I have changed the code to check if a DLL exists in C:\InstallLocation to load the DLL from that folder. From Process Monitor output, it would seem this is getting me closer. However, I am seeing an error later in the process. Here is the error that I am seeing now (multi-level exception).
The type initializer for '<Module>' threw an exception.
A nested exception occurred after the primary exception that caused the C++ module to fail to load.
The type initializer for '<Module>' threw an exception.
The C++ module failed to load during vtable initialization.
Could not load file or assembly 'XYZ, Version=N.N.N.N.N, Culture=neutral, PublicKeyToken=NNNNNNNNN' or one of its dependencies. The system cannot find the file specified.
Interestingly, in my custom Assembly Initializer code, I see XYZ.DLL being loaded from C:\InstallLocation. Is it possible this C++ module is attempting to load it differently or in a way that isn't supported by ASP.NET?
I am trying to deploy an ASP.NET 5 application to my 64-bit Windows Server 2008 R2 server. I created a blank web application and set up a file system publish profile using dnx-clr-win-x64.1.0.0-beta4. I copied the results from the publish location to a folder on my server and created a new virtual directory with a .NET 4.0 app pool pointing at the wwwroot folder of my application. However, when I try to browse to the site, I get this error:
Could not load file or assembly 'dnx.clr.managed' 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
'dnx.clr.managed' or one of its dependencies. The system cannot find
the file specified.
The same steps on my local PC (where I have Visual Studio 2015 installed) work correctly so it seems like I need to install something else on my server. I have already installed .NET 4.6 on this server without success. Does anyone know what I am missing?
I found the solution thanks to this question: Azure deployment : Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified
At first I thought that wasn't the answer because it didn't work when I changed my publish profile from dnx-clr-win-x86.1.0.0-beta4 to dnx-clr-win-x64.1.0.0-beta4. However, I later noticed that approot/packages folder didn't have the x64 package. So I deleted everything and re-published with my new profile and the page loaded.
Change the dependencies file to the current version, whether it is 1.0.0-beta7 or 1.0.0-beta6 ensure that you go to nuget package manager and install the appropriate version rebuild the solution you should see file updates from your output windows.
I am running a kentico app and am extending some user functionality through some custom written code. As a result of that I have written a small object/database library to pull some data from an external database to display through a webpart (ascx file). This is compiled into a DLL I would love to upload to my app.
My question therefor is:
Can I manually upload the DLL to the ASP.NET apps bin folder at runtime? Continuously, can I then reference and use this DLL in my code file (ascx)?
(Attempted sequence below)
library.dll > /bin
upload .ascx file
>>use
I've rigorously attempted to read the documentation on the runtime behavior within the IIS, but without much luck. But am curious of which the application will simply reload or break.
Yes you can. The application will be restarted, new dll loaded and then you can use it in the ascx control.
So I am trying to convert the Latest repository from BlogEngine. They are using MVC3. Now I moved all the files, Renamed App_Code-->Set to Compile. Converted all the Files to Web Application. My only problem is I keep getting:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'Helpers' does not exist in the current context
<div>#Helpers.ExtensionsHelper.GetExtensions(true)</div>
BlogEngine.NET doesn't really use MVC, but it uses Razor web pages that usually installed with MVC 3 or Webmatrix. If you don't have those installed, you need to move DLLs from downloaded lib/Razor folder into application's /bin folder.
I am trying to check the connection with one of active IBM MQ’s but I am getting this error..
Unable to load DLL 'amqxcs2.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I am using the following code..
Included amqmdnet.dll and amqmdxcs.dll in bin and gave the same reference to the project.
using IBM.WMQ;
using IBM.WMQ.PCF;
Any remedy for this.
Thanks
Sreenath
Seems that the file is not present, make sure the library is either where the application needs it to be or the library is in the GAC.
If the file is present and the error still occurs, make sure the file is not blocked. Open the file properties and check if there is a button "unblock" in the "General" tab of the properties window. If so, klick it and try again. This seems to happen when you download a library or extract a library from an archive downloaded from an untrusted source.
This may be a COM error. The IBM assembly is probably a native dll and so you cannot register it in the GAC, which is for .NET dlls only. Native COM dlls can be registered with Regsvr32. This error can also occur if a native dll has a dependency on another dll that is missing. Also see Understanding Dependencies of a Visual C++ Application which gives information about the Dependency Walker tool that can be used to figure out the depndencies for a native dll.