C# AWS Could not load file or assembly 'AWSSDK - c#

When I publish my app to my server, and call a function which is dealing with Amazon SQS, I'm getting the following error:
ErrorMessage: "Could not load file or assembly 'AWSSDK, Version=1.5.19.0, Culture=neutral, PublicKeyToken=9f476d3089b52be3' or one of its dependencies. The system cannot find the file specified."
However the same method works fine in the localhost.
How should I solve this problem ?
Thanks.

Most common cause is the .dll is not present in the bin folder of your publish web-site.
Verify that the bin folder contains the AWSSDK.dll file.
You can ensure that the .dll is copied by setting the "Copy Local" proprety of your reference to true

I had this problem with the MysticMind port of the HtmlAgilityPack
Could not load file or assembly 'MysticMind.HtmlAgilityPack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Access is denied.
The problem was the version number - the nuGet package is tagged as version 1.0.0, but in the .csproj file of the source I found that the actual version was 1.4.9.4 (the version of the upstream package). I fixed it by changing the version number in my own .csproj file.

My DLLs were being copied to the bin properly but I was still getting the error.
My project was in SVN I resolved this by getting a fresh copy of the dll from svn and then doing a clean and build.
Seems somehow the dlls got corrupted or something.

In my case, it happened because my App.config file contained:
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK"/>
</configSections>
I included it blindly from the doc here. It has a new example on the top but the old ones are in the examples below. The right way now is:
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
I sent feedback to AWS (March 21, 2022) and hope they will fix it soon

Related

Could not load file or assembly 'PdfSharpCore, Version=1.3.40.0

I am using PdfSharpCore version 1.3.40 in a MVC ASP.Net netcoreapp2.1 and it works perfectly on my windows localhost, but when I publish it on a server Linux running Apache the follow exception occurs:
Could not load file or assembly 'PdfSharpCore, Version=1.3.40.0, Culture=neutral, PublicKeyTo ken=null'. The system cannot find the file specified.
I already checked that the PdfSharpCore dll is there, but the system couldn't find it.
Does anyone know what's going on?
We managed to solve the problem, we were forgetting to replace the .deps.json file that contains the dependencies with the new PdfSharpCore.dll dll included in the project. Solved!

Application requires that assembly office version 12.0.0.0 be installed in GAC

I have a .csproj that I want to publish to a clickonce server.
When I publish the application from one development computer it works and the program can be started from the server without any problems.
I download the same project from svn to another computer and try to publish it. That step kinda works, i guess, since the program is published successfully without any errors.
But when I try to start the program from the server I get the error:
Application requires that assembly office version 12.0.0.0 be installed in the Global Assembly Cache(GAC) first.
Update: (also posted info in comments). I am receiving this warning on both machines though I don't know how to solve. But it's probably the cause of the problem I guess:
No way to resolve conflict between "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" and "office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Choosing "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" arbitrarily.
1> Consider app.config remapping of assembly "office, Culture=neutral, PublicKeyToken=71e9bce111e9429c" from Version "12.0.0.0" [C:\Windows\assembly\GAC\office\12.0.0.0__71e9bce111e9429c\office.dll] to Version "14.0.0.0" [D:\Visual Studio\Visual Studio Tools for Office\PIA\Office14\office.dll] to solve conflict and get rid of warning.
So I finally solved this.
First I thougt I'd describe how the project looked. Under references there was no reference to the office.dll file though this actually ended up in the published directory when computer1, which was able to publish a working copy, published the project. Also under properties->publish->ApplicationFiles the office.dll was listed as exluded.
computer2, which couldn't publish a working project, had the same installed programs as computer1. So I tried to add the reference to office.ddl, set it to copy local and include it in applicationfiles. Now there was a office.dll copied to the published directory but the same error appeared. installed and re-installed a bunch of programs, no improvement. After I've been trying alot of randomstuff I ended up copying the dll from computer1, referenced it, set it to copy local and included it. And, voila, it worked?

Could not load file or assembly 'AjaxControlToolkit, Version=4.1.7.1213

I have Publish Project with reference of Ajax Version=4.1.7.1213 and deployed single page(Not ajax dll version 4.1) at Other machine (that machine having ajax version 1.0).
It shows me error like:Could not load file or assembly 'AjaxControlToolkit, Version=4.1.7.1213
But when I Publish again with reference of Ajax Version=1.0 and deployed same single page at Other machine (that machine having ajax version 1.0). Its work fine.
My question is When DLL get created after Publish is it stored reference of Ajax Version.
Please help
Edit the web.config file to remove the reference, which is not required for normal operation:
1 - Open the web.config file in the root of your site
2 - Find the following line and comment it out():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 : Mismatch in Assembly and Product Version
I'm not sure if I understand you correctly. If your project is dependent on AjaxControlToolkit, Version=4.1.7.1213 you should make sure that it is available on target machine.

Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies

I have this exception generated on some user machines (~1 of 20):
Could not load file or assembly 'System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified.
I found several references to this error over the web and this site but nothing helped.
I have an add-in application which uses WCF to connect to the server. The add-in built with .NET Framework 3.5 with VS 2008.
The error is reproducible on one of the test machines in only one user account. I install my application and can only reproduce this from one account on this machine everywhere else it is working fine. Furthermore it is only reproducible with only one version of host application which I created add-in for (I assume because it uses differnet .NET Frameworks).
I have checked the fuse logs and I see the following:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\SolidWorks Corp\SolidWorks\sldworks.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Home\User
LOG: DisplayName = System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/SolidWorks Corp/SolidWorks/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
So by some reasons it is trying to use v2.0.50727\mscorwks.dll loader to load the Version=4.0.0.0 of System.dll. On build machine I'm referring 2.0.0.0 version of System.dll.
I had this same problem - some users could pull from git and everything ran fine. Some would pull and get a very similar exception:
Could not load file or assembly '..., Version=..., Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.
In my particular case it was AjaxMin, so the actual error looked like this but the details don't matter:
Could not load file or assembly 'AjaxMin, Version=4.95.4924.12383, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies. The system cannot find the file specified.
It turned out to be a result of the following actions on a Solution:
NuGet Package Restore was turned on for the Solution.
A Project was added, and a Nuget package was installed into it (AjaxMin in this case).
The Project was moved to different folder in the Solution.
The Nuget package was updated to a newer version.
And slowly but surely this bug started showing up for some users.
The reason was the Solution-level packages/respositories.config kept the old Project reference, and now had a new, second entry for the moved Project. In other words it had this before the reorg:
<repository path="..\Old\packages.config" />
And this after the reorg:
<repository path="..\Old\packages.config" />
<repository path="..\New\packages.config" />
So the first line now refers to a Project that, while on disk, is no longer part of my Solution.
With Nuget Package Restore on, both packages.config files were being read, which each pointed to their own list of Nuget packages and package versions. Until a Nuget package was updated to a newer version however, there weren't any conflicts.
Once a Nuget package was updated, however, only active Projects had their repositories listings updated. NuGet Package Restore chose to download just one version of the library - the first one it encountered in repositories.config, which was the older one. The compiler and IDE proceeded as though it chose the newer one. The result was a run-time exception saying the DLL was missing.
The answer obviously is to delete any lines from this file that referenced Projects that aren't in your Solution.
I got this after downgrading a project from .net 4.5 to .net 3.5.
To resolve I had to go in to the project - properties - settings window and delete all my settings, save the project, exit and restart visual studio, go back into project - properties -settings window and re-enter all my settings and their default values
This worked for me.
Go to Project->Propertied->Target Frawork->Change frame work like 3.5 to 4.0
I had the problem under Linux and I needed to install those. I don't know which one actually fixed the problem, but that error was gone after that:
apt-get install mono-utils mono-runtime-sgen mono-runtime-common \
mono-runtime-boehm mono-runtime-dbg mono-xbuild
I've seen this a couple times, and it is usually fixed by running a repair on .NET Framework (whichever version the application is trying to use).
You are using .net 4? - Maybe on the clients there is only the ".net framework 4 client profile" installed. Try to install full package!!
Download here
In my case, I was able to find issue with ScriptManager by setting Debug=true in web.config file
I answered too late but it has worked in my case.If you are facing this issue in your project please add the following line in your web.config :
<compilation batch="false" >
This worked in my case. If you already have compilation tag in your web.config then add only batch="false" property to it.
You can enable NuGet packages and update you dlls. so that it work.
or you can update the package manually by going through the package manager in your vs if u know which version you require for your solution.
Even I have experience some more strange things, I can see there is no dll in GAC from where the dll is loading but windows > Module shows system.dll version=4.0.0.0 loaded
i just changed my target .net framework and it worked .in my case i changed from .net 4.7 to .net 4.
Right click your solution and select properties
selct properties
Click Application >> Target Framework
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
this is my problem. I installed system.configuration assembly in the project and other class libraries also. now the problem has gone.
am used net 6.0 with aspcore.report and problem like this happened with me
I installed system.configuration assembly in the server project problem solved

Why this instance creation of reqpro40.applicationclass fails?

I am trying to open a ReqPro project from c# class code. The steps followed are:
Add reference to ReqPro.dll (the extensibility COM dll)
Create a type of ReqPro40.Application and have an instance of ReqPro40.ApplicationClass like:
ReqPro40.Application appReqPro = new ApplicationClass();
ReqPro40.Project prjReqPro;
prjReqPro = appReqPro.OpenProject(#"D:\MyReqPro\MyReqPro.rqs", ReqPro40.enumOpenProjectOptions.eOpenProjOpt_RQSFile, "admin", "admin", ReqPro40.enumProjectFlags.eProjFlag_Normal, ReqPro40.enumRelatedProjectOptions.eRelatedProjOption_ConnectNone);
The code compiles well, but when run (I wrote a simple Unit test), it fails saying "Could not load file or assembly 'Interop.ReqPro40, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Interop.ReqPro40, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null".
Update1:
I tried it on my laptop, and it worked fine. I have ReqPro installed on my laptop. But it does not work on the server (Windows 2008 Enterprise). I connect to the server using remote connection. Any clue?
Update for bounty
I shall expect some working code with steps to recreate.
Please check on the server that the ReqPro.dll is in the root folder, sometimes the referenced dll's dont copy to the bin folder. You can also specify a "Probing" element in your app.config file to specify subfolders that the CLR can search to locate a referenced assembly if it cannot find the assembly.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schmas-AWorks-cam:asm.v1">
<probling privatePath="bin\Ordersbin;Extbin"/>
</assemblyBinding>
</runtime>
</configuration>
Update:
If you arn't already I would suggest you use a Setup Project to Install your Project, this will make sure any 3rd party dlls, automatically get copied to the root folder were the application is installed.

Categories