I have recently copied an entire Visual Studio project (folder containing all files and subfolders) from one machine to another.
I've then opened the project .sln file, and hit debug. The first error that i get it that it can't find Form1 (the very first Windows Form in my project). It gives me the option to select the file manually, but if i navigate to the Form1 file it tells me that the:
Source file is different from when the module was built. Would you like the debugger to use it anyway?
If i do this, the next thing i get is a DirectoryNotFoundException whereby it's looking at this file path:
Could not find a part of the path 'O:\TestDaws\CSDB'.
Now this file path did exist where i was running this program from previously (at work). Now i'm trying to run it from home, it does not. But i cannot find ANYWHERE that refers to the O: drive in my code. Tried searching and it finds nothing.
The only answers i can find seem related to Source Control. And i have no source control. Also seen people recommending deleting the .suo file. I'e tried that and that also has no affect.
The file path it's looking for must be in some meta data or settings file somewhere that Visual Studio creates, and i can't find. Any ideas please?
Related
I have a .csproj file that I merged another developers changes into, apparently incorrectly. It's now saying (load failed) The project file cannot be loaded.
There's no information on what it doesn't like though. Where can I find out the errors that Visual Studio sees when it tries to load my project?
-Eric
Pretty obvious, I should have seen it earlier. I did a Reload Project and it showed me a message box with the problem.
The messagebox error message was something like:
The project file
c:\dev\mypath\blah\blah\MyProject.csproj
has been moved, renamed or is not on your computer.
What was really odd was that the the path that messagebox complained about didn't seem to exist in any .csproj files, .sln files, etc. None of the places I would expect it to be. I found that it was in the MySolution.suo file. I deleted that file and it loaded correctly the next time. Go figure.
A small but very annoying issue I have:
In our current working way, all .config files are excluded from source control. Also a .tmpl file with the .config content is included in the source. So when I check out a project from source control I end up with:
[Triangle]Log4Net.config
Log4Net.Config.templ
In my solution explorer. Clicking on the Log4Net.config file (predictably) gives the error, "The item 'Log4Net.config' does not exist in the project directory. It may have been moved, renamed or deleted." Fair enough.
I am looking for a way to "make" that file, like for eg. right click force open, that will open a new empty editor window where I can paste in the content. (I can easily just copy it from the .tmpl file).
Anything like a plugin, or a keyboard shortcut or similar would be what I'm looking for.
Update: To clarify, the .sln/.csproj file(s) are checked in referencing the files. I check this out and open in visual studio. I see the yellow triangle moaning about missing files. Now I need to recreate these files, and I would like to use VS to do so...
How do you move a Visual Studio C# project and maintain the linked files?
For example;
I have a VC# Project that sits in folder: A/V2013_Project.
This VC# Project links to files A/Image/a.png this is because we have many other projects that use this file also.
I want to move my project to A/Release/V2013_Project. Ie move the project to a sub-folder.
I'm not renaming anything in the new project, not changing anything else except for the location of the project.
When I move the project all my links fail (theres more than 50) and most of my references fail. By fail, I mean they no longer point to the file. Within the newly moved VC# project; when I click on a linked file VC# displays an error:
Cannot find the file A/Image/a.png. It may have been moved or deleted.
But this file was never moved. Its still in exactly the same place.
How can I move a VC# project and maintain the links and references? Are there any 3rd party addons that can do this?
Edit: Using wintermute's advice; the links are indeed relative and not absolute. For example;
<Resource Include="..\..\Resources\Other\Images\TOOLBAR_close.png">
<Link>Resources\Other\Images\TOOLBAR_close.png</Link>
</Resource>
Any ideas how I can make links absolute in VC#?
It depends on how the file is linked. It isn't clear from your question.
Some files are references by the .csproj file. Close Visual Studio down (just to be sure) and open the .csproj file with Notepad or some other text editor. See if the files you're talking about are referenced there. If so, add the text "..\" in front of each file name, indicating they are one directory higher up, relative to the project location.
Some files are referenced in the .resx file(s). In this case Visual Studio should have included the name of the .resx file as part of the error message. This can be fixed using Visual Studio's editor. Double-click on the error message and it should open the .resx file with the file reference that is in error as the selected line. Again, add "..\" in front of the file name.
You say you have 50 references. Hopefully this means you can search-and-replace to add the "..\" text to the relevant file names.
Edit:
You posted an edit to your question, showing this line:
<Resource Include="..\..\Resources\Other\Images\TOOLBAR_close.png">
If you really want to make this absolute, then just do it.
<Resource Include="D:\Merlinia\Trunk-Debug\Add-Ons\Picture Editor\VS2012 projects\PictureEditor\Resources\Other\Images\TOOLBAR_close.png">
But as I mention in a comment on your question, make sure this is the best way to fix the problem.
I had a Properties file called RecentFileList within my Visual Studio 2012 project and I removed it. I believe it was a .settings file. Now when I run my setup project, it is trying to copy files that it shouldn't care about and it's bombing out as a result. I get 3 errors (-1007 -6271 and -6103), all related to the same missing file.
-6103: Could not find file "C:\Users\Charles\Documents\Visual Studio 2012\Projects\RallyCourses\RallyCourseDesigner\bin\Debug\Properties\RecentFileList.Designer.cs
What file do I need to edit to get rid of the reference to this file? I tried searching for RecentFileList.Designer.cs, but can't find it.
The offending files in my situation were trying to be installed by the installer, but I had removed them from the main project. Within the SetUp project, there is a section Specify Application Data -> Files. I found the files in the Properties section there, removed them, and things are working now...
Using Visual Studio 2010 to remote debug a C# .dll -- getting .PDB file does not match - any yet it is absolutely the from the build...............
New info: [[ This problem is not resolved. I have three computers: a)XP sp3, b)XP sp3 and c)Vista sp1, I can build the simplest of test programs on a) and c), and using the module window -- select my test5.exe and load the .pdb that was created when it was created - same date same time same folder... and yet Visual Studio says "a matching symbol file was not found in this folder" -- all efforts to load the correct .pdb fail with not matching complaint.... be it: a) remote to b) or c) -or- c) remote to a) or b) --- HELP! ]]
I have set the location of the .PDB implicitly and explicitly - does not matter....
I have set the symbol settings to be unchecking that source files must match exactly....
I am seeing no Errs....
Just:
C:\POSWIN\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\obj\Debug\DBS.KGW.tst7.pdb: PDB does not match image.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\symbols\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\DBS.KGW.tst7.pdb: PDB does not match image.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\MicrosoftPublicSymbols\symbols\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\MicrosoftPublicSymbols\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\Projects\SP\DBS.KGW.tst7STUB\DBS.KGW.tst7\bin\Debug\MicrosoftPublicSymbols\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\WINDOWS\symbols\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\WINDOWS\DLL\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
C:\WINDOWS\DBS.KGW.tst7.pdb: Cannot find or open the PDB file.
A couple of suggestions:
In visual studio, while you are attached to the process, open the modules debug window, Ctrl+D, M (or Debug -> Windows -> Modules from the menu) and find the dll that's causing issues. Right click it and select Load Symbols From and then Symbol Path locate the correct pdb file and see if it loads.
If you're app is asp.net, then you could try clearing the temp folder as it sometimes causes problems similar to yours. That folder should be located somewhere like this:
bootdrive:\%windir%\Microsoft.NET\Framework\v2.0.5 0727\Temporary ASP.NET
Depending on your .net version.
The solution is that for remote debug connections there are two ways to connect, authorized and unauthorized... For firewall issues, I defaulted to unauthorized. For VS 2010 C# solutions the complaint is merely the .PDB does not match. Having exhausted all options I could think of I went and reproduced my simple test solution in C++, the interface is different and better and there is a warning as you set this up that you will not get symbols unless you are on an authorized connection!!! -- Once I overcome the firewall issue -- and see my symbols via an authorized connection to the remote PC that is being debugged, I will post that confirmation...... btw, often it is warned that when you sign-on via an authorized connection the user ID and password for both the host and debugged computer must be the same, furthermore the user on the debugged computer must have "logon as service" right added to its user.....
I have got same problem and solution was so easy...
In my case, I have two VS solutions, first is main app with .exe and second .dll plugin project. When I tried to debug a dll project, I get a pdb not matching error (in module window). The reason was that pdb was actually not matching at all because:
When I was testing first solution, I copy .dll file from second solution to debug folder with .exe file.
Then when I tried to debug second (.dll) solution, it was using .exe file from first solution AND ALSO THE .dll file in that directory, but that .dll was outdated and didnt match with new pdb file. So copying a new .dll file from second project to .exe directory resolved my problem.