A matching symbol file was not found (Cannot find/open pdb file) - visual-studio-2013

The debug point is not getting enabled when this module gets loaded. So I thought of manually loading its debug symbols .pdb file from "Debug/obj" folder.
In this case I am getting below error "A matching symbol" file was not found in this folder though that folder contains currently build file.
And also the "Symbol Load Information" contains these many directory paths.
Cannot find or open the PDB file.
PDB does not match
Screenshot:

This problem is fixed by the following steps-
1) Close all the instances of VISUAL STUDIO if running and open a single instance of Visual Studio
2) Close the solution (nothing but your project) If it's already open and then re-open again
3) Clean the whole project and rebuild it.
4) and also build the project if you are getting any errors like "___.dll not found"
5) Now you are good to go and run your project

After breaking my head on this, for me it happened when I configured my project to seperate binaries from objects that way:
For Output directory:
$(SolutionDir)build\bin\$(PlatformTarget)-$(Configuration)\
For Intermediate Directory:
$(SolutionDir)build\obj\$(PlatformTarget)-$(Configuration)\$(ProjectName)\
Even though the I still had the generated .pdb where my exe or trying to even load it manually, it didn't work.
So I went again to Configuration Properties -> Linker -> Debugging and where the property Generate Program Database File I changed from $(OutDir)$(TargetName).pdb to $(IntDir)$(TargetName).pdb so it will throw the desired database file into the place where the objects(Intermediate Directory) are instead of where the .exe(Output directory). Hopefully that helped someone :)

Related

Visual studio wrong file path for Form1.cs file

I am trying to open a project which was created on one computer but has since been moved to another one due to the computer going caput. Now when I open the project and try opening the Form1.cs file, or any of the designer files, I get the error message saying "Cannot find the file 'C:...\Form1.cs'. It may have been moved or deleted". I have omitted the full path which is a reference to the old computer.
How do I change the file path so that my project can find it?
I have found another thread on this issue: Visual Studio retrieving an incorrect path to a project from somewhere
Have tried all of the suggestions (deleting .suo files, moving the project to a new folder, etc.) Nothing has worked so far. There is however in the accepted solution a reference to "Manage Workspaces" and "Source Control Explorer", which I literally can't even find in my Visual Studio window.
Help please!
Alexander
First: Open your sln file and see where it says your csproj file is located. It should read something like: "WindowsFormsApp1\WindowsFormsApp1.csproj"
Note: Everything in the parenthesis will be from the same directory as the sln file, so the true directory in this instance will be "sln_file_path\WindowsFormsApp1\WindowsFormsApp1.csproj"
As long as this is correct, then navigate to the csproj file and open it with notepad, but if this path is wrong, correct it before proceeding.
Second: Search the csproj file for the missing file, which in your case is Form1.cs
You should find something like: Compile Include="....\Erroneous_Directory\Form1.cs"
Typically all cs files will be in the same directory as the csproj file, so the line should simply read as follows: Compile Include="Form1.cs"
If the file is legitimately located in a separate directory, then provide the path, but if it is in the same directory, delete the path. Sometimes, when linking to a file in a different project, you will see this: (Link)Form1.cs(/Link), but if the file is in the same project and directory, this link line will need to be deleted.
Note: Chances are that this procedure will need to be repeated for two other files: Form1.Designer.cs and Form1.resx as well, so make sure the "Compile Include" lines for these two files are also correct before opening the solution

Prevent Visual Studio from deleting output files from referenced projects

I've got a Class Library project and a Console project. Inside the Class Library project there's a folder called "ConfigSettings" containing a configuration file that's referenced by the App.config file. Its "Copy to Output Directory" is set to "Copy Always".
The Console project references this Class Library project. When the console project is built, the ConfigSettings folder is created in the correct place along with the external config file. However, every time I Debug the Console project, the external config file is deleted. The ConfigSettings folder however is left untouched. If I mark the file as read-only it is not deleted, and warning appears in Visual Studio's Error List:
Warning Unable to delete file "C:\<path>\<app>\bin\Debug\ConfigSettings\settings.config". Access to the path 'C:\<path>\<app>\bin\Debug\ConfigSettings\settings.config' is denied.
Is there a setting I can change that will prevent VS from removing this file when I Debug the project? I am using Visual Studio 2015.
This might not be the best solution possible, but I found here, if you do a "Clean solution" just before executing your solution, the files will remain.

Renamed visual studio project, error when publishing (ResolveAssemblyReference.cache)

My solution contains two projects. Both have been renamed from 'LearnUmbraco.*' to 'OnceUpon.'
The solution builds fine, however when trying to publish via FTP, the error occurs:
Error Copying file obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache to obj\Release\Package\PackageTmp\obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache failed. Could not find file 'obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache'. 0 0 OnceUpon.WebUI
If I look in my obj/Debug folder i do indeed have a ResolveAssemblyReference.cache however it is obviously prefixed with ;OnceUpon.**.'.
Where/how is this file generated. I'd like to change the configuration so it looks for the renamed version.
Many thanks
Found the issue. Close the solution and open the csproj file. The old references were still in there.

How to handle "Cannot find or open the PDB file" at VS 2010?

I am trying to debug a project, that has libs files, libs files and exe files, If I run this project without debugging it compiles well and execute well.
But its debugging doesn’t work, It says : [Cannot find or open the PDB file]
* tvctrlpt.exe is the name of exe on which I am working now.
Seems I am making mistakes in project build debugger settings ?
Do I need to consider anything specific on this ?
[for your information – I am doing the windows debugging for following : http://sourceforge.net/projects/pupnp/forums/forum/569833/topic/5409226]
See below log:
tvctrlpt.exe': Loaded 'D:\libupnp\build\vc10\out.vc10.Win32\Debug\bin\tvctrlpt.exe', Cannot find or open the PDB file
EDIT
Here I am using the http://pupnp.sourceforge.net/ [ libupnp 1.6.17] , it compile well, and run as usual, but while running the debugger - it says - Cannot find or open the PDB file.
searched all across internet, and tried all the ways for various settings, but it didn't work, seems it require little more deep knowledge to do that.
Or some settings etc..

Unable to copy file exception in TFS build

I am getting following error
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (178): Unable to copy file "bin\AjaxControlToolkit.pdb" to "C:\Builds\2\testbox\test\Binaries\_PublishedWebsites\test\bin\AjaxControlToolkit.pdb". Could not find a part of the path 'bin\AjaxControlToolkit.pdb'.
Just checked file is available on path.
same working fine on local as well as while building from team city. Don't know whats going wrong.
Edited
Just cant understand why it is trying to copy from obj directory..Please see the following log
Copying file from "obj\Debug\Manager.dll" to "C:\Builds\2\box\Two\Binaries\Manager.dll".
Manager -> C:\Builds\2\box\Two\Binaries\Manager.dll
Copying file from "obj\Debug\Manager.pdb" to "C:\Builds\2\box\Two\Binaries\Manager.pdb".
Copying file from "obj\Debug\Manager.xml" to "C:\Builds\2\box\Two\Binaries\Manager.xml".
Done Building Project "C:\Builds\2\box\Two\Sources\Manager\Manager.vbproj" (default targets)
Where as I have set the output to bin.
Possible reasons:
This reference is dynamic, meaning its path gets cleared and created on each build. Third party reference files should be checked in the source control to a common shared folder (e.g. \lib).
Your project have a file reference to AjaxControlToolkit to a path
which does not exist on build the server. Open the project's .csproj
file,and check the HintPath of AjaxControlToolkit.
Avoid referencing third party assemblies from the GAC (where the first bullet is applicable).

Resources