random cs files not opening in visual studio 2012

前端 未结 6 1567
灰色年华
灰色年华 2021-02-19 19:47

So here\'s my pickle. I\'m using Visual Studion 2012 and been developing my application without a hitch. I opened VS today and I can open all the files as I normally would (cs

相关标签:
6条回答
  • 2021-02-19 20:02

    Well, this might not have fixed your issue, but what I did was delete my .suo files, and it stopped prompting me for files that were long-since gone.

    I'm just posting this here for others who might come along and find this helpful.

    0 讨论(0)
  • 2021-02-19 20:05

    I have had this problem randomly with VS 2012, and though I haven't found the root cause (I feel it is a bug in Visual Studio because it doesn't happen in 2010 in the same projects), I found how to disable the annoying symptom and just proceed with debugging. There is an option to turn off the checksum file check, in Tools -> Options -> Debugging -> General:

    Require source files to exactly match the original version Tells the debugger to verify that a source file matches the version of the source code used to build the executable you are debugging. If the version does not match, you’ll be prompted to find a matching source. If a matching source is not found, the source code will not be displayed during debugging.

    http://msdn.microsoft.com/en-us/library/85yzd16c.aspx

    The downside is, if you have breakpoints in a particular file that is affected by this issue, then you may find VS won't trace into that file, so this option should only be used (IMO) if there are files causing trouble that you don't care to debug.

    I will update my answer as I find more.

    0 讨论(0)
  • 2021-02-19 20:07

    I had this same error and it was caused by my dlls in one project not getting up to date with another project dependency. I tried rebuilding, deleting bin files, clearing cache and a few other things. None of it worked for me.

    Here is a simple example of my scenario. Project A was dependent on Project B. Whenever Project A hit a point in debugging where it called a method in project B I received the error.

    What worked to fix my issue:

    • Put both Project A and Project B into a single VS solution. (If you have many projects that all depend on each other, you can place them all in the same solution, I actually had 9)
    • Clean and Build both projects. (to get them synced within the new solution)
    • Set your startup project to be Project A (or whatever you were previously trying to debug.)

    Now you should be able to step through both project's code.

    0 讨论(0)
  • 2021-02-19 20:08

    I also had this issue with Visual Studio 2013 (a.k.a. version 12.0), driving me nuts. Repairing, uninstalling, reinstalling, deleting .dlls, .csprojs, .suos, cleaning, rebuilding. Nothing helped. As a last resort before doing a clean install of Windows, I went through these steps which successfully solved the problem:

    • Removed VS through Windows' Add/Remove feature.
    • Deleted all files and folders referencing Visual Studio 12.0 in %AppData%, %ProgramData% and Program Files (x86) (this last one left me 13k files totaling 200 MB+ after uninstall)
    • Rebooted
    • Ran CCleaner's file and registry cleaning tools
    • Used regedit to search for 'Visual Studio 12' and '12.0', essentially removing all keys/folders referencing Visual Studio 12.0 (leaving pure file references as they amounted an insane number)
    • Rebooted, ran CCleaner again, rebooted.
    • Installed Visual Studio 2013 again, changing the path from '... 12.0' to '... 12'.
    • Manually applied a Windows hotfix (KB2664825) which somehow failed during installation.

    Done, and it worked!

    On a side note, my parallel installs of VS2010 and VS2012 was not affected at any point of the issue I was having with VS2013.

    0 讨论(0)
  • 2021-02-19 20:15

    https://stackoverflow.com/a/10028684/4222878 works perfect for me. After deleting file path in solution debug ignore list you should rebuild entire solution.

    0 讨论(0)
  • 2021-02-19 20:18

    In my case the files had some unicode characters or other encodings, possibly a result of corrupted file. I right clicked-> Open With...-> and switched to the "C# Editor with encoding" option. Note this will prompt every single time to ask if it should auto detect encoding, which is very annoying but hopefully you can find the offending characters and fix them.

    0 讨论(0)
提交回复
热议问题