I have a primary project which refers to DLL of a secondary project. I changed some code in secondary project, built it and changed the DLL reference in the primary project to the updated DLL.
Now, in VS 2010, when I press F11 to try and debug the updated code from the secondary project, it shows the following error and takes me to the old code when I press OK.
This source file has changed. It no longer matches the version of the
file used to build the application being debugged.
I have tried Clean+Build, Rebuild, cleared temporary files etc. I checked the properties of the DLL and its path points to the newer version(updated code). But the problem still persists.
In short, VS is completely ignoring the new code. Any clues how to resolve it?
Related
After an energy fault, my mac mini was shut down inappropriately and now I simply can't work anymore with VS for mac(8.6.7 build 2). If I add a new class file or any new xaml tag, giving it a name and reference it on code behind, VS doesn't links these references. This already happened other times but this time it doesn't compiles the project also.
Error CS0103: The name 'MinhaAnimacao' does not exist in the current context (CS0103) (MyProject)
Everything that was compiled before that works fine, so if I compile without new elements it pass ok and VS finds its references as expected.
I was using VS 8.4, have updated to 8.6.7, but no success. Also tried to delete bin/obj from main folder(not on android/ios folders).
EDIT:
Just have noticed that VS broke the project files. With other projects it works fine. Do you guys know how to fix project files?
I can add an image to a form no problem, and it builds with no errors. Then, when I relocate the project, there is the error 'does not support code parsing or generation because it is not contained within a project that supports code' when I reopen the project from the new file location. This can be resolved by removing the form and adding it again, however this would have to be done every time the project is opened after being moved, and for anyone trying to open it from a new location.
I've tried adding the image in various ways, and I've tried adding different images. Every time, images are added with no issues in the original project location, however as soon as the project is moved this error keeps occurring.
How can I add an image to a C# project in Visual Studio 2019 while retaining the ability to move the project to a different location without resulting in errors whenever the project is reopened?
*EDIT I'm now wondering if this occurs after a certain amount of time that the project is copied, instead of because of adding an image. I have started to get the error again after I have copied the project about 10 times, which is around when I started to get the error when I was working with an image included in the project.
**EDIT I have rephrased the question here: After I have copied a C# project in Visual Studio 2019 about 10 times or so, I get an error when I reopen the project
Remove Special characters from Project folder Name.
Amend Project file paths in solution File.
Delete .vs Hidden folder or .sou file
I recently had a similar experience where i would get the error when trying to open the designer in VS after i moved my project.
to give some context i moved a project from TFS to GIT source control. I created a project in azure devops and the project name contained a space.
the clone url then escaped the space character as %20, when Cloning this repository from the command line without renaming the destination folder I ended up with a folder name containing %20 in its name, instead of a space. my solution file then had the same naming conventions containing the %20 in the project path.
This https://social.msdn.microsoft.com/Forums/en-US/cadde249-3fa9-46de-aa23-37ceae612e8c/form-not-contained-wiithin-a-project-that-supports-code?forum=winformsdesigner helped me:
Close the solution. go to the solution's file folder and delete the solution's .SUO files. Then reload the solution in Visual Studio. In the solution file explorer, right click on the targeted form source and select the "View code"(not "View Designer"). When the source file is opened, then right click over the source text and select View in designer.
I'm trying to create a Monogame Project in Visual Studio 2012. Monogame itself is installed correctly, I've cloned one of my older projects from github and it compiles fine.
But if I create a new project in Visual Studio the .dll references are wrong. There is a build error that complains about not finding SDL.dll . There is the SDL.dll reference in my project outline and it indeed points to the wrong file:
This path "C:\Users\lhk\Program Files..." does not exist. Windows doesn't store Program files in its "Users" folder.
I opened the explorer and opened the very same path without "Users\lhk\" and the .dll is found.
Then I checked my older project again. The same SDL.dll is referenced in the Visual Studio solution but the path is the correct one. And the older project compiles just fine.
Somehow the Monogame Project template fills in the wrong paths.
Now here's the problem:
I can't edit that reference.
The text is greyed out and not editable and I didn't find the correct settings to change the reference.
Oh, the problem is solved:
I tried drag-and-drop with the dll.
So far Visal Studio always complained that there is an existing file with the same name.
I tried to "cut" the wrong .dll but that only made its icon slightly transparent. The new .dll still couldn't be added.
Turns out that the ENTF key can do what cutting can't.
I'm afraid I never got the idea that I could delete it with ENTF after cutting didn't work. Now its gone.
I dragged the new dll over to the project.
Compiles fine
Apparently you can just drag and drop references to a project.
At first I thought this wouldn't be possible because the wrong .dll just couldn't be deleted. I tried to "cut" it from the project but it just changed the color of its icon and persisted.
With the old .dll still intact the new one couldn't be added.
I'm afraid the solution is extremely simple. You can just remove this reference by pressing "ENTF" - it's rather embarrassing. But I never thought this would work after cutting had no effect.
With the old reference having been removed you can indeed drag and drop the new one.
The project compiles fine.
What I did is create a path on the drive and put the sdl.dll file there. So whenever I make a project Visual Studio finds it.
in my solution:
i have a class library project that compiles into a dll.
i have a web project.
(i have multiple solutions with different web projects but the same class library)
one of the files in the class project (utilities.cs) - all of a sudden won't compile into the .dll
i had made a change to this file, but the change wouldn't show on the website. so i put a breakpoint in the .cs file, and tried running it... breakpoint didn't get hit! eventually i put a breakpoint in the .aspx file that called the function. then i stepped the debugger one line on, so it would step into the .cs file, except i got the error:
"This source file has changed. It no longer matches the version of the file used to build the application being debugged."
so the code in utilities.cs is not being updated into the dll. which is weird, because code in my other .cs files IS being updated (i tried changing a few lines) and IS able to catch the debug.
any ideas how to fix this? or even what the cause of the problem is??
Try:
Right click on Solution in Solution Explorer -> Properties -> Configuration Properties -> Make sure Build checkbox is checked for your class library.
You need to find out why the DLL will not build:
Look at the output window for any errors
Check the Errors window
Fix the errors and try building again.
The dll that you are trying to debug is from an older version of your code that did compile OK and the debugger pickes that up and is trying to debug against that - it is complaining because the code and the dll no longer match.
Try doing a Build -> Clean on the solution and then rebuilding to see the errors.
When You adding new references to Web project You must choose "Projects" tab:
Projects lists all reusable components created from local projects.
Add or Remove References in Visual
Studio
Add a Reference to a Visual Studio
Project in a Web Site
Always rebuild all projects in Release and Debug mode.
I did exactly what #nightcoder said but a simple change was required. Go to Configuration Properties(Right click on Solution in Solution Explorer -> Properties -> Configuration Properties) and select "All Configurations" in Configuration option.
This created the .dll for me
This happened to me after switching between branches in a project which have significant differences between them, I tried every solution from the web but non worked.
Finally, I had to delete my local project files and clone the project from the GitHub repo again, after that when I started the project, the project build worked without errors, and dll was generated.
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints are not connected. Error indicates that the compiled code is not the same as the running version and therefore there's a mismatch that causes the breakpoint to be disconnected.
Cleaned solution of all bin file and re-compile doesn't help. Not just happening on a single box or person either.
Added Note:
This solution is in TFS for Source Control. If I delete my local TFS repository and get it from source control from scratch, SOMETIMES the problem goes away. I've also tried un-installing and re-installed Visual Studio. That also SOMETIMES helps. That fact that both of those work some of the time indicates that the problem isn't caused by either directly.
Maybe this suggestion might help:
While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
Look for your project's DLL, and check the Symbol Status for it.
If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
I've found that it's sometimes necessary to:
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
Source: The breakpoint will not currently be hit. No symbols have been loaded for this document.
http://dpotter.net/Technical/2009/05/upgrading-to-ie8-breaks-debugging-with-visual-studio-2005/
In Options -> Debugging you can uncheck "require source files to exactly match the original version", which may help.
Is the build configuration set to Release?
Do you have a reference to an external DLL where the breakpoint is set?
Are you creating a DLL project that is consumed by an external executable? Are you using .NET or COM?
If you are using the COM Interop with .NET, the DLL versions can sometimes be a problem when the executable loads the DLL. For instance, if your daily build cranks out an incrementing build number but your debug DLL has a smaller build number, the executable won't load the debug DLL. To fix this, you will need to scan the HKEY_CLASSES_ROOT\CLSID directory in your registry for the GUID/CLSID of your .NET/COM component. Under InProc32, delete entries with a higher version number than your debug DLL.
Again, the above only applies to .NET + COM Interop DLLs.
I've had a similar problem in the past.
It was solved by closing Visual Studio and deleting the temporary ASP.NET generated assembly files for the project under "C:\WINDOWS\Microsoft.NET\Framework{framework version}\Temporary ASP.NET Files", re-opening the project.
Read the post here and the comments to resolve it.
AviewAnew - had already done that at the request of the MS tech person. It didn't help to uncheck require source file to match version.
Mike L - configuration is set to DEBUG and there are now external DLL. Using all local projects except framework references.
Are you sure the .pdb files are in the same folder as the executable you are running? Make sure the last modified date of both files match, and that VS is attached to that exe (and no other).
Do you have a post build step that touches your binaries in any way? If so, this can confuse the debugger and make it look like your symbols don't match your exe/dll because of the incorrect size/timestamp.
In the past I have sometimes found that switching off compiler optimisations can solve 'missing' breakpoints, as the optimiser had determined (correctly) that the code was not being called, and removed them from the compiled versions.
This does sound like a different issue, but it might be worth making sure that optimisation is switched off in Debug mode. [Project / Properties, Build settings tab]
Sure there are no Debug attributes on the code that prevent code from being debugged, such as DebuggerHidden or DebuggerStepThrough, at any point of the application?
Can you step through your code up to the line of the breakpoint instead of running and waiting for it to hit? Can you step through code at all?