"Could not load file or assembly 'Microsoft.WindowsAzure.Storage" when AjaxToolKit in Bin folder - asp.net

I'm learning ASP.net and working on a project in Visual Studio 2008. When I originally installed the AjaxControlToolKit I unzipped to a folder on my desktop, added a tab to the toolbox and browsed to the dll on my desktop. Everything worked fine until I realized the problem I had created.
I'm now trying to move the toolkit to my bin folder. I deleted the tab on my toolbox, deleted the reference to the AjaxControlToolKit on my desktop, unzipped to my bin folder and added a new tab with the correct path to the dll. When I run the project I receive an error:
"ASP.NET runtime error: Could not load file or assembly 'Microsoft.WindowsAzure.Storage' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
The problem only seems to occur when the ajax dll is located in my bin folder. I made another folder in my project and unzipped the toolkit there and everything worked fine. Any ideas?

I had same problem today and I got fixed it after checking every 'Microsoft.WindowsAzure.Storage reference in my all project solutions references or project solution references.
Must have to have same version of all, then it should be fine.
Try it and let me know.

Related

Visual Studio 2017 won't compile my ASP.NET web project, saying "could not load file or assembly" for a library that is definitely being referenced

Current Situation:
I have an ASP.NET web project. (Framework Version: .NET Framework 4.5.2)
One developer here is able to compile it and run it fine in Visual Studio 2017.
I cannot, I get the "could not load file or assembly" error for a reference that is in my list of references.
Screenshots:
Error:
Bin Folder:
Web.config Potential Relevant Sections:
DevExpress Licenses File:
DevExpress Library File's Details:
Things I've Tried:
Clean Solution & Rebuild Solution
Deleted solution locally and clean get of solution from source control
Clearing out my temp directory
Opening the project in Visual Studio 2015
Having the developer zip up his local copy of the solution / project and sending it to me (When I ran his copy locally I continued to get the same error.)
Re-adding the existing library it's complaining about
Manually deleting and re-adding all the libraries in my BIN folder
Messing with the license file, web.config, and assembly references in code (including adjusting the version numbers because for some reason the version number is 17.2.5.0 anywhere it's referenced in the project, but the file's Details actually says it's 17.2.9.0?)
Smashing my face into my keyboard...
...Always the same error.
Additional Information
Other developers run into the same exact error under the same conditions as me, only my one developer who's been working in this project can build it fine
I just noticed that on a new copy of the work project, my references window is showing 2 of the same reference to the DevExpress.Data library (one in the GAC and one in the BIN) but when I try re-adding the reference to my project, the one in the BIN disappears from my references window:

Unable to load DLLs when starting up IIS Express hosted web project (VS2015)

Backgroud:
I am in the process of migrating a console application to be part of our existing web API project. All development work is done on Visual Studiod 2015 (with IIS Express). The application uses few third party datasource api DLLs to grab data from that datasource. All these DLLs are managed by our internal nuget package sources.
Issue:
Now the console application runs fine and can load up the those DLLs. I copied across the logic into my web project and added the DLLs via nuget. Solution builds but got the following error when starting up the web project:
Could not load file or assembly 'ABC.DLL' or one of its dependencies. The specified module could not be found.
Where ABC.DLL is one of the third party DLLs.
I have done the following:
Confirm ABC.DLL is in the bin folder of my web project
Changed target build platform of my web project to be x86 and unchecked "Use 64 bit version of IIS Express for websites and project" setting in VS2015 (the third party dll is 32-bit)
Ran dumpbin.exe on ABC.DLL's dependency and got XYZ.dll,MSVCR120.dll,KERNEL32.dll,MSVCP120.dll,mscoree.dll
Regarding to the last step, those dlls were all missing in the bin folder (but the last 4 DLLs should be in system32 win directory so shouldn't matter?)
As for XYZ.dll, it is another third party library and is located on C:\Program Files (x86)\XYZ\ folder. I manually copied it across to the web project bin folder (in fact copied across all Dlls inside XYZ folder) and still get the same issue.
Questions
What am I missing here? The console app obviously can load ABC.DLL but the web project can't. Appreciate it if you can tell me what to check next.
The error message from start up web page is not very useful, is there a way to find out where the web project is trying to load the third party DLLs?
Thank you in advance!
Simply adding external DLLs to your Bin folder is not a great idea. Files can disappear from this folder for various reasons, such as your team members deleting a seemingly useless DLL, or through Visual Studio clearing it. Also, the output DLLs from referenced projects in your solution, would end up there, and are replaced every time you build your project.
What you should do for third-party DLLs, is create some "dependencies" folder in, or close to, your project, and stick the DLLs in there. Then you should right-click on the project, select Add Reference, browse to that new "dependencies" folder, and add a reference to the DLL that way. This is similar to the way NuGet works; it keeps DLLs in their respective folders inside the packages folder, and adds references to those DLLs.
I finally found the issue and thanks for all the help, I had to disable shadow copying in VS (mentioned in 64 bit managed assembly with unmanaged dependencies not loading in IIS / ASP.NET MVC 4).

How to move and build Asp.net project to other computer?

I developed a website using VS2012, Asp.net MVC4 and entity framework in old computer.
and I copied the project to new computer, in VS2015 project folder, and try to run it. but there are many warning sign in reference.
I don't know what the warning sign means..
How can I solve that problem? so that I can build the project in new computer?
[Edited]
I did, 'Update-Package -Reinstall', and I found still some of reference are still with warning sign. and the package path was pointed to bin directory.
So I copied the bin directory then,
and,
How should I do to solve this problem?
You should look on the old computer where are those references coming from. Whether they are added as NuGet packages or directly referenced from some lib folder which you forgot to copy. On the old computer click on the assembly reference and open the properties window (F4) which will show the physical path to the assembly. On the new computer you should replicate the same folder structure so that the assemblies can be resolved. Alternatively you may take a look at the corresponding .csproj file.
If they were added as NuGet packages, then you should restore them using the following command:
Update-Package -Reinstall
This will look for a packages.config file in all projects in the current solution and download and install the NuGet packages listed there.

Visual studio unable to detect Sitecore.Web namespace

Currently I'm playing with sitecore 7. I followed this blog to setup my visual studio with the sitecore.
Everything is fine until when I tried to create a sc:placeholder on the aspx.
It throws this error regardless whatever sitecore control I have tried to insert:
Error 180 The type or namespace name 'Web' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
C:\inetpub\wwwroot\abc Sc7\Website\layouts\Customized\MainLayout.aspx.designer.cs
I tried to create a placeholder using code behind, no error was thrown.
I have tried to create an empty web application project. And added a reference to only Sitecore.Kernel.dll
I created a dummy page to test out the reference to the dll thing.
It still throws the same errors.
I know the blog mentions it, but have you added a reference to the "Sitecore.Kernel" DLL in your project? Open your references folder and ensure that there is not a problem with the reference.
Make sure your project is using .net 4.5 (you will need to use something other than VS2010)
After default sitecore installtion Sitecore.Kernel assembly is placed in bin folder. Maybe you used 'Clean project' and after this operation your assembly was deleted. Please check if this assembly is present in bin folder. It should be loaded by IIS automatically from bin folder, even if you have wrong reference in you csproj file.
When I start new project I always move dlls from bin folder to other folder, and put references to this files in csproj, so when I run clean project (or clean solution from VS) i have empty folder (only one file is present - *.lic file).

MVC: Visual Studio Publish Web dialog cannot find my application's Views

I am using these steps to publish my ASP.NET MVC 4 application using Visual Studio 2010 on IIS 7.5 running on a 64-bit Windows 7 Professional machine.
When I click the Publish button on the wizard after entering the values, it reports a single error that reads:
Copying file Views\Shared\Error.cshtml
to obj\Debug\Package\PackageTmp\Views\Shared\Error.cshtml failed.
Could not find file 'Views\Shared\Error.cshtml'.
I looked into the target folder where the wizard dumps the necessary files that will be needed to deploy the application. It turns out that the folder had the Views folder which had only the _ViewStart.cshtml of the root Views folder, but no other View. My application has at least 20 views, perhaps more.
I realized that it was my fault. The local copy of my project had the file Error.cshtml in the Views\Shared folder. However, the TFS copy of the project file did not. Apparently, the file had been excluded from the project at some stage.
I excluded the file from my project locally and ran the build and it worked.
In my case the problem was that the file was in the solution but didn't actually exist on the local file system.
For me, this problem occurred when I moved a file (via explorer) from the shared folder to another folder.
I added the file in visual studio, but did not "delete" the file from the shared folder (as far as visual studio was concerned).
For some reason, visual studio did not put a little flag or warning sign to tell me the expected file was missing (even after a refresh), so I didn't notice (although trying to open the missing file revealed the problem).
The error message is clear, and self explanatory. I just couldn't understand it for some reason.

Resources