stdole.dll has already loaded from a different location? - c#

I'm trying to build a solution composed of multiple projects in Visual Studio 2010, but one of the projects is giving me a strange error when I compile it:
Cannot load referenced assembly: C:\Windows\assembly\GAC\stdole\7.0.3300.0_b03f5f711d50a3a\stdole.dll
System.IO.FileLoadException - API restriction: The assembly 'file:\\\<same as above>' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
At first I though I would need to remove this stdole.dll reference, so I deleted it. However, after deleting it, I get the following error instead:
The type or namespace 'stdole' could not be found (are you missing a
using directive or an assembly reference?)
Adding the reference back again gave the first error again.
I understand why I get the last error, but I don't understand why I'm getting the first. I'm fairly new at .NET, and am the only one remaining at my current company with any experience with C#, meaning that there's no one here who can help me. I've also spent some time trying to look up a solution online, but my lack of experience in this domain is making it hard for me to find an answer I can understand.
Any help with this would be greatly appreciated!

You can directly add reference to file by address for example:
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
Not from GAC (Registered Assemblies)

Related

How to solve 'AlprNet' could not be found?

I looked for the answers here and there with no luck, so I decided to ask out.
I want to implement openalpr (open source Automatic License Plate Recognition)
repository on my own PC and I am following this video to accomplish the task. I have done all the steps he did and at the end, when I tried to build it but, in one of the .cs code there is CS0246 error that says:
Error CS0246 The type or namespace name 'AlprNet' could not be found (are you missing a using directive or an assembly reference?) number_plate c:\users\sohib\documents\visual studio 2015\Projects\number_plate\number_plate\Form1.cs
I could only find AlprNet in my D:\Projects\plate_recognition\openalpr-master\src\bindings\csharp\AlprNetTest and it is in .csproj format.
AlprNet is not in .dll format like other references so I cannot reference it in References.
I found some say that it might be because of different versions of .NET Framework platforms. I almost did nothing to check that, because I don't think it's related to .NET
In my mere opinion I should link that AlprNet.csproj to get its content, but I'm not sure. If someone can help get around this issue, I'd be very grateful.
If it's not a .net Assembly (dll) that's referenced and it's not a nuget package, then check that the code isn't expecting the Assembly to already be present in the Global Assembly Cache (If you have access to another developer machine where this works, this is easy to check).
Failing that, adding the .csproj to your .sln and then referencing it sounds like the way to go (provided you have access to that of course!).

C# cannot find a used and referenced class

I and a few friends are building a program made from 4 projects we are putting together.
While developing, we decided to move a class from one project to another. We changed the namespace and made sure all of the projects reference to the one containing it.
When running the project, the compiler gives a couple of error:
The type or namespace name 'dataList' could not be found (are you missing a using directive or an assembly reference?)
Cannot implicitly convert type 'DAL.dataList`1<classes.IBase>' to 'classes.dataList<classes.IBase>'
dataList is the class we moved from DAL to classes.
The class appears colored, and when I attempt to show the location by doing classes.dataList, it recognizes the class, but the compiler still gives the error.
A problem that appeared to one of us was an internal conflict that the compiler was reading from a deleted old file instead of the correct one (so it failed to load it properly), but it was fixed, and now this popped up.
It was resolved- I'm not entirely sure why or how. As far as I gathered, one of us played with the DAL, added and removed the references and it solved the issue.

Type or namespace name does not exist in the namespace - yet the namespaces do exist

A project that I've been working on for a long time without any problems suddenly started throwing errors such as
The type or namespace name 'xxx' does not exist in the namespace 'yyy' (are you missing an assembly reference)?
In this case, the namespaces were all core .Net libraries such as System.Data, Linq, and IO that I've been using without any problems.
I've worked through all of the issues in this question such as making sure all the projects in the workspace are using the same version of .Net for the Target Framework setting.
I removed all the libraries in question and re-added them but the problem persisted. I doubt they libraries themselves are corrupted as I reference them in other projects within the solution.
After rolling back through my work with TFS I managed to work out what I'd done that had created this error: I'd added a folder called "System" to my project and put a class file in it.
This is an easy issue to reproduce: create a project, add a folder called system to it (it will still compile at this point) and then create a .cs file in it, that's when all the fun errors will occur.
The problem stems from the name of the "System" folder which leads to any files created in it being under the namespace ".System".
I can understand why having a folder / namespace called "System" would cause problems now but I think it would help if Visual Studio warned when creating a folder / namespace of such a name to stop this problem happening in the first place. I've logged a bug with MS, at least having this logged might help any other people who have made the same mistake as me!
I had the same issue after my system shut down unexpectedly and even though VS tried to restore, the problem popped up.
I had two projects in my Solution Explorer. To solve this, I right-clicked the project that was associated with the error message and selected 'Build'.
After that, the issue was resolved.
Just to add that the problem was permanently solved after I added a reference to the 'project' from the other 'project'.
I renamed the namespace of the file I was referencing from myproject.shared.constants to myproject.SOMETHING.shared.constants
After that It suggested "use myproject.SOMETHING.shared.constants" as suggestion. I renamed it back to myproject.shared.constants and then it worked.
Try to Clean and Then Rebuild the dll file .I was experiencing the same problem tried different suggestions from internet but none of them work.But it will. In case you don't know how follow these steps:
open your dll project file.
2.click on solution Explorer Right click on Your Dll Project Name you will find Clean and Rebuild Option.

How To Find All Code References To a Particular Assembly

Does anyone know if there is any way to find all code references to a referenced assembly?
For example, lets say there is a project with 15 assembly references and not all of them are being used. Would it be possible to see all usages of one particular reference?
The only way I know how to do this is to delete the reference and try and build. The error list shows me all the references but this seems kind of hacky..
I am using VS 2012, Update 1.
thanks.

Visiblox invalid assembly reference

I am struggling with a problem regarding to visiblox. I am quite new to the WPF concept, but I am getting the hang of it. I have quite some expirence with the classic forms.
My problem is that the designer keeps telling me that the XAML contains errors. And I get the folling error in my error list:
Unable to load the metadata for assembly 'Visiblox.Charts'.
This assembly may have been downloaded from the web.
See http://go.microsoft.com/fwlink/?LinkId=179545.
The following error was encountered during load: Could not load file or assembly
'Visiblox.Charts, Version=2.1.4.31043, Culture=neutral, publicKeyToken=1543c03f04c4461b' or one of its dependencies.
I have added the reference to the project, and I have added the line:
xmlns:charts="clr-namespace:Visiblox.Charts;assembly=Visiblox.Charts"
I can build and run the project, but the designer keeps telling me that my assemblies are not correct. I tried to clean and rebuilt the project. Restarted Visual Studio and the computer, but nothing seems to work. Anyone any clue? Thank you in advance.
I'd suggest following the link it provides: http://go.microsoft.com/fwlink/?LinkId=179545
The problem is that the dll is "locked" by windows security and you need to unlock it before you can reference it. The link specified tells you how.

Categories

Resources