HRESULT 0x8007006E on including a DLL into a project 'lib' folder - visual-studio-2012

For a project I am working on, my team generates reports on the server with ActiveReports. We've generated a License DLL that allows report functionality to work.
In our VS2012 solution, we've included a /lib/ directory that holds certain external DLLs, such as the ActiveReports assemblies and this license DLL.
However, upon attempting to add the DLL to the project, we get two errors, back to back. I attempted to add the extant DLL using these steps:
In VS 2012, right click our /lib/ folder, and click 'Add Existing Item...'
Browse to the Windows directory where the License DLL Is and select it, click Open.
Upon doing this, though, I receive two errors back to back:
Could not open the file
The system cannot open the device or file specified. (Exception from HRESULT: 0x8007006E)
I have checked my local operating system permissions to ensure that the folder the DLL lives in is accessible, and that the path of the object that appears in VS 2012 points to the correct place. Question: What is causing this error? Surely, I'm missing something...

I received the same error trying to open a file with VS's binary editor. The file was already open in another app. After closing the other app and I was able to open the file in VS without error.

Related

How can I Get visual studio to use source server in preference to local files when debugging?

I have just started experimenting with the Microsoft tools to set up a symbol and source server.
I have successfully indexed my source files using p4index, updated the .pdb files and updated the symbol server.
I have set visual studio to use the my symbol server.
All works fine: when I step debug through my exe as a standalone exe the pdb's are loaded and the correct version of the source code is exported from perforce to temp location and displayed within visual studio.
Whats the problem then? If I try to debug on the machine on which I built my exe then visual studio finds the source code locally. The trouble is that this is a modified file and not the correct version of the source corresponding to when exe was built. VStudio even knows this and pops up a requester saying "the source file is different from when the module was built. Would you like the debugger to use it anyway?"
If I click no then I just get a file dialog to manually locate the source.
Is there a way to get vstudio to fall back to using source server or preferably to use the source server first before looking looking locally?
I'm using visual studio 2012 and perforce
After having encountered the same issue, I finally narrowed it down to the fact that Visual Studio won't run the P4 PRINT command if there is already a file at the place where the pdb/debugger expects to find it.
For example, if the indexed source file was in C:\Toto\Source.cpp, the sole presence of this file when Visual is looking for it will prevent the P4 PRINT.
If i rename it, Visual is correctly printing the file in another unrelated folder (the symbol cache pass).
It's not a fix, it's only a reason, but I'm still investigating.
This behavior is not present in windbg.
In case anyone else finds this thread and has the same problem, the solution in my case was to Enable "Require source files to exactly match the original version" in Options -> Debugging -> General.
It will still prefer the local copies, but only if they are identical, in which case it is the same version it would otherwise grab from the source control server. And if it isn't the right one, it will now display the proper one from the source control server.

could not load assembly or one of its dependencies. The system cannot find the file specified

I am working on a windows application and I am using another dll with name diffplex. I have stored it in the bin folder of my solution. in properties I have set it as copy local = false.
When I am running the program from visual studio it is working fine. But when I copy exe from bin to some other location and try to use this application I am getting this error - "could not load assembly or one of its dependencies. The system cannot find the file specified"
Please find the screen shot attached. But I want to give my client only exe file not the dll file. What can I do.
Hi Finally the issue has been fixed. A tool MS ILmerge is used which on post build event makes both exe and dll as one file

Write access to the local file system inside a Visual Studio Add-In

I am developing an Add-In (in C#) for Visual Studio 2012 and I am trying to use NLog to log information from the Add-In code to a local log file (e.g. in the same local directory that the Add-In is being loaded from). Nothing was being logged and then when I debugged things some more it seems that I just do not have write access to the local file system from inside the Add-In code. Simply trying to open a local file and write a line to it throws a System.UnauthorizedAccessException:
[System.UnauthorizedAccessException] = {"Access to the path 'C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\test.txt' is denied."}
Is this just a basic limitation for Add-Ins? Does VS just not allow write access to the local file system?
Thanks for any insight you can offer
Alan
After digging around in the NLog source code I finally figured out what was going on here.
The real problem was that I was putting the NLog.config file in the wrong place and so NLog was not finding it. I was putting it in the Add-In directory with the .AddIn file and the binaries. Rather than throwing some kind of exception NLog was just silently disabling logging. This is perfectly reasonable behavior in hindsight since it's legitimate for logging to be just disabled if the config file is not present. Anyway, no logs were getting written and my first thought was that it might be a permissions issue. I then just tried to create a file (test.log) and write to it in my Add-In code and then saw the exception above which just reinforced my (incorrect) suspicion that there's some security model that prevents Add-Ins from writing to the file system.
So, we need to be mindful of directories:
The Add-in Directory: This is where the .AddIn file and related binaries will live. This is where Visual Studio will look for Add-ins and load them from.
The default directory for Visual Studio: Remember that it's devenv.exe that owns the process, not the Add-in. So the default directory will be where devenv.exe lives not where the Add-in lives. Also note that this directory is write protected for non-Admin users. This is where NLog will look for the NLog.config file!
The path to the logfile target in the NLog.config file: This needs to be a writeable location. Just specifying a file (e.g. test.log) in the target will represent a file in the default working dir for Visual Studio which, as we noted above, is not a writeable location.
So, in order to make things work I had to:
Put the NLog.config file in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE. I needed to do this as Admin.
Specify a full (writeable) path for the logfile in NLog.config

Publishing Web site without installing Microsoft Report Viewer

I have a web server with ftp access only, and I can't install Microsoft Report Viewer on it.
How do I publish my asp.net app to the IIS without installing ReportViewer?
I have copied following dlls to my site bin folder:
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.Common.dll
Now I am getting error saying:
An error occurred during local report processing.
The definition of the report 'Reports\QuotationViewReport.rdlc' is invalid.
An unexpected error occurred in Report Processing.
Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I can't even find a dll named Microsoft.ReportViewer.ProcessingObjectModel.dll in my local machine.
Is it possible to publish my application without installing ReportViewer ?
Pre-requisite : having Microsoft ReportViewer assemblies installed on your development machine (as answered by webkite).
In Visual Studio, from the Add Reference action of your project, choose browse tab and browse to the GAC.
(C:\Windows\assembly\GAC_MSIL).
There, find the Microsoft.ReportViewer.ProcessingObjectModel assembly folder, choose the version sub folder suitable for your needs, and add the assembly as a local reference.
Then locate the assembly in your references list, and switch its Local Copy property to true.
For other report viewer assemblies, you should be able to add them directly from the .Net tab in Add Reference dialog box. Do not forget to switch the Local Copy property to true for them too.
With this setup, the ReportViewer assemblies will be copied to your build directory at each build, and you should be able to copy them easily to your target deployment environment.
You may instead try some of the ReportViewer packages than can be found on NuGet. But none of them seem officialy provided by Microsoft.
Download & Install
Microsoft Report Viewer 2010 Redistributable Package
http://www.microsoft.com/download/en/details.aspx?id=6442
Add these files to your website's bin folder:
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WebForms.xml
This is now available as a NuGet package:
http://www.nuget.org/packages/Microsoft.ReportViewer.WebForms/
Install-Package Microsoft.ReportViewer.WebForms
try C:\Windows\assembly and search for Microsoft.ReportViewer.ProcessingObjectModel
Or
You can find ReportViewer.exe at the following location: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ReportViewer\ReportViewer.exe
after you run ReportViewer.exe, the file will copied to the Global Assembly Cache folder on the deployment computer
hello you can find the dll file open your project
and add refrences and choose browse and select c:/windowse /assemple/GAc_msil
here you find microsoft report viewer folders and select what you want

Debug a custom solution for Sharepoint 2010 in visual studio

I built the WSP file manually (using CAB utility) and uploaded them to the sharepoint 2010 server. I want to debug the dll that was packaged in that WSP file to test if the events are caught by the listener. I attached to w3wp.exe (all instances that appears). however I find that the symbols are not loaded for any break point to be hit and the thread is getting exited with some run time exception.
what Am I missing here ? Do I have to copy my PDB files at any particular location ?
thanks
you have the answer in your question. yes you have to upload your pdb file to GAC using command prompt and copy statement
which would be available under
C:\WINDOWS\assembly\GAC_MSIL> in directory form open it and copy your pdb thier
or easier option is compile your wsp in debug format
You don't need to copy the PDB symbols file into the GAC if Visual Studio is configured correctly :-
Fortunately, it's just as easy to
debug in the GAC as it is in BIN if
you configure the development
environment correctly.
Unfortunately,
few know how to do this because the
internet is polluted with pages full
of bad information that is a held over
from previous versions of .Net.
You
can spot these easily because they
will say you need to copy the debug
symbols (.pdb file) to the GAC. In and
of itself, that will not work. These
days it is also completely
unnecessary.
To configure VS ... to debug the
assemblies properly, do the following:
You mention the Sandbox tag in your question, so you have to attach to SPUCWorkerProcess.exe and not w3wp.exe, the sandbox code runs in an isolated worker.

Resources