I know this isn't a programming question but it is a programming tool question.
In Visual Studio 2008 Team Edition (version 9.0 with .NET 3.5 SP1) when I copy and paste references from one csproj to another (with the context menu in the 'Solution Explorer' view) I get the following error:
Error HRESULT E_FAIL has been returned from a call to a COM component
This has only just started happening on my machine. I can only find this article about it, and it contains no solution.
Any ideas?
This is the #1 hit that shows up on Google for VS 2010 paste reference E_FAIL and the like, so I thought I would share this workaround:
Don't use copy/paste references via the context menu in Solution Explorer.
Instead:
Use the context menu to unload the project to copy references from.
Edit the project file (.csproj; it's just XML).
Find the
reference(s) you are interested in and copy the <Reference> XML
node(s).
Unload the project to copy the reference into.
Edit the project file (.csproj)
Paste the reference copied in the previous step into appropriate location. You need to look for
the <ItemGroup> node containing something like <Reference Include="mscorlib" />, and paste your reference just above it.
Close both .csproj files, saving the just-modified target one as well.
Reload both projects via Solution Explorer context-menu.
Your reference is now copied into the target project.
Apparently, at the very minimum, there is a problem with references that use environment variables, as described here (although in my case, I was having a problem with references that did not use environment variables, and in Visual Studio 2010...)
Yikes , E_FAIL is the most generic COM error , since it literally means a COM function returned fail. I would guess that somehow , visual studio 2008 has a corrupted COM object somewhere.
Have you tried reinstalling visual studio 2008 just to get it to re-register all its tlb's and objects ?
Related
I'm currently making an extension for Spotfire that embeds a web browser (CefSharp) into the application. However, when I attempt to run the package, I get the error:
"Package 'D3Visualizations' has unresolved assembly references:
'CefSharp, version 1.25.4.0' is referenced by 'D3Visualizations.dll'."
I've added CefSharp.dll and CefSharp.WinForms.dll as references, and I have added those two as well as icudt.dll and libcef.dll into the bin/Debug folder.
I honestly don't know why it doesn't work right now; the last time I got an error in the package builder like this, it was due to .NET version mismatches.
What am I doing wrong? I'm using Visual Studio 2013 Express Desktop, and the project is in .NET framework 4.5.1.
Can you check the path for the references in their properties window? You can try removing and re-adding the references to the dlls in your bin folder and set Copy Local = true. If that doesn't work try setting it explicitly in the project file as in this question: Force VS to reference local dll
I have written a DLL and then in my solution I am adding a reference to it, but when I declare it in the usings section, it gives me error that this is not recognized, are you missing a reference?
here is how I set up my solution...
1- First I had created my DLL. Let's name it MyDLLLibrary, sitting somewhere on hard drive.
2- I also had a solution, consisting of several other projects...for all of these I have created a folder like "C:\_debug" and I have set "Output Path" and "Reference Path" of all these projects to point to that common folder. So far, s good.
3- Now I add that MyDLLLibrary to this solution, change its "Output" and Reference Path to point to the same common debug folder, use Add Refrence and at the reference to MyDLLLibrary to the project I want in the solution and rebuild the solution...
Now if I use a using statement, still it doesn't recognize it.
I even tried the add refrence from projects tab..that didn't work either.
Check the project properties of both assemblies and make sure that the framework setting for both is .NET Framework 4 and not .NET 4.0 Client Profile or something else.
While using Visual Studio 2017, I had to close visual studio and delete the .vs folder (at the root of the solution). This fixed my issues
We have an application wrote in C#, which broken into several projects. These projects have reference to others.
When someone gets the source from version control and opens the solution contains these projects on its own machine, Visual Studio cannot find the references between projects, even though referenced project is build successfully. That person have to re-add the reference to solve this.
Seems to me that Visual Studio keeps some data in `suo' file, so next time it knows where to find that re-added reference, and this problem won't appear next time the person opens the solution.
Since `suo' file keeps absolute path to references, we cannot commit it in our source control.
The problem is, We've got a separate machine, which builds this big application automatically (as our nightly-build releases) When the build-automation tool opens the solution, and calls Visual Studio's compiler to build it, the references cannot be find. (automation tool cleans everything, and get the latest version of the source again, so it dose not have `suo' file.)
Any solution?
Extra information
Visual Studio version: 2008 - 9.0.21022.8
.Net framework: 3.5 SP1
OS: Windows XP Professional (SP2 & SP3 - we have both of them)
Update
Seems that Visual Studio changes <ProjectReference> tag to <Reference> in `.csproj' files sometimes. Our developers commit the file, and this problem happens.
I couldn't find if it's a bug in Visual Studio. The only solution that comes into my mind is to write a tool to correct this in `.csproj' files, before pass it to the automation tool.
References are defined in the .csproj file for each project. They may be defined in one of two ways (in my experience).
Either with a hint path to find the referenced assembly:
<Reference Include="CommonServiceLocator.NinjectAdapter, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Dependencies\CommonServiceLocator.NinjectAdapter.dll</HintPath>
</Reference>
Or without one:
<Reference Include="CommonServiceLocator.NinjectAdapter, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL"/>
You need to make sure that the references are in the first form, that the hint path exists, and that it's a relative path so that it works no matter where you check out the solution.
You can edit the .csproj files either with an external editor, or by right clicking the project, choosing "Unload project" from the context menu, then right clicking again on the unloaded project and choosing "Edit projectname.csproj". After you 're done editing, right click again and reload the project.
Open the project files (*.csproj) and look what are they referencing. Mostly sure the paths are relative to the solution path and your build script might use other paths.
One way of solving this:
Define an environment variable SOURCE_PATH that holds the path to your sources root folder
Edit the project files so they have reference relative to this path (use $(SOURCE_PATH)) in csproj files to reference it
Repeat steps 1-2 on each dev/build machine and add extra env variables if needed.
PS: The *.suo should not be in the version control system.
Why won't you use msbuild rather then automated visual studio compiler?
It's a bug in VisualStudio 2008 and before that.
If you open a solution that contains a project that have reference to another project, but referenced project doesn't included in the solution, VS finds the referenced project, but changes the reference in a way that it refers to the output DLL, not the project itself.
This bug is fixed in VS2010, and MSBuild 4.
Without much luck I've been trying to attach the HTMLTidy c++ library dll within Visual Studio, however everytime I get various errors with different builds. I'm adding a reference to the project and then manually selecting the dll, which has been copied into a lib folder within the project folder.
The first dll I tried was from Mark Beaton, and I'm using his HTMLTidy wrapper as it seems the most up to date. The standard Win32 one was built.
Mark Beaton Builds
I've also tried the build from the official HTMLTidy page, again the dll
Official Build
The error when referencing, please help! I've tried compiling from source, but the source doesn't seem compatible with VS 2010.
libtidy.dll is an unmanaged C DLL, so you can't add a reference to it in Visual Studio's Add Reference dialog. You need to build the C# code from https://github.com/markbeaton/TidyManaged into a managed DLL, and add a reference to that DLL instead.
Make sure that libtidy.dll is copied to your output folder; you can achieve this by adding the DLL file to your project, and changing its properties to "Copy to Output".
I have a Visual Studio 2008 project that has a reference to a dll. I removed the reference to version 1 and added a new reference to version 2. The project builds successfully, however when I analyze the project dll after it has been built in Reflector I am seeing that it is holding onto two references to the same dll - version 1 and version 2 are both referenced.
If you look at your project file in notepad, can you see both references in there? You may have to scan through a bit of xml to find them... If so, you could manually remove the old one and resave the project in notepad.
go to Property pages and remove it easily