VS2010 cs file opening in Notepad

家住魔仙堡 提交于 2020-08-08 06:25:34

问题


Yesterday while was writing code in model Repository suddenly power off. I left and when I open now Repository.cs was opening in notepad. Actually in Notepad it is empty.

Any way to recover the code as I don't have back up of my whole days work?

How to reopen it?


回答1:


Try with this..
There are possibility for code loss when power breaks are there.. The primary solution is You can recover from back up files and add it with ur application. or If you have AutoRecovery enabled, you might be lucky enough to find a backup of the file. Chances are that Visual Studio would’ve prompted you to restore the corrupted file when launching it after the crash. Anyway it’s still worth checking the backup folder for your project, in:

%USERPROFILE%/Documents/Visual Studio [Version]/Backup Files/[Solution Name]

Other ways to recover

Recover the affected file in VS




回答2:


This thing recently happened with me, I also haven't any backup of my work and my laptop gone shut immediately after a lag. Then I restarted my Project Solution and it was same thing came to me, my CS file was opening again and again in Notepad. After some try i Got my data and file, let me Explain the Process, how i recovered my File :-

[Read Carefully]

Step 1 :- Right Click on your Root Folder into Solution Explorer.

Step 2 :- Click on -"Open Folder in file Explorer", Then your Solution will be open in the file explorer.

Step 3 :- then Right Click on the File like "Default.aspx.cs" which is opening into Notepad.

Step 4 :- Then Click on "Restore Previous Versions", and select the time you were Working and click on "Ok" Button.

Step 5 :- Now Go and See the file into your Solution, Your Data will be there,

Note :- if, after this all, the data doesn't come into the file, then refresh the folder.




回答3:


Don't quote me on this. But you may try opening the entire project inside of VS2010 IDE, and it may be cached in there. I'm assuming you know how to open files with other programs.




回答4:


You can recover the file. Do this if anyone still having this issue.

1) Exclude the file from Solution Explorer(Right Click>>Exclude) 2)Include the file again (Right click in directory icon in Solution Explorer>>Add>>Add Existing Item)

You will have the file available in Visual Studio.

Hope this help



来源:https://stackoverflow.com/questions/26071480/vs2010-cs-file-opening-in-notepad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!