My project in Visual Studio is Read Only. What did I do?

人盡茶涼 提交于 2019-12-05 09:34:24

问题


I must have done something wrong. I have a C# project in Visual Studio 2008. All of a sudden I see a lock on my classes and when I hover the class names on the top tab I see the class name as : C:\Myprojects\Oder.cs[Read Only] !

Has something weird like that happened to you before?


回答1:


A couple of possibilities spring to mind:

Have you added the project to source control?

Have you marked the project folder (and all it's sub folders) as read only?

Of course, someone else may have done either of these things if they have had access to your machine.




回答2:


In my case it was a ReSharper 9.0/9.1 related issue. After clearing the ReSharper cache, I was able to edit files in my solution again.

Clearing the ReSharper cache can be done here: ReSharper -> Options -> Environment -> General and click: Clear Caches and restart your visual studio.

(The image is contained within the first of the linked JetBrains articles).

JetBrains instructions:

Ultimate Guide to Speeding Up ReSharper (and Visual Studio) - Performance degradation after ReSharper upgrade

ReSharper Online Documentation




回答3:


One Possible stupid thing.

Your project is still running and you forgot that. Stop debugging (CTRL + F5)

How do I know. Guess..




回答4:


Restarting my computer worked for me. My project became read only in between compiles - suddenly I couldn't save changes to files, Visual Studio started presenting me with 'save as' dialog boxes, and SVN couldn't commit or clean the project because "sqlite could not write to readonly database." Checking the file properties on the files in Windows Explorer showed that none of them were marked read-only. I was able to make a backup copy of the project, then I restarted and it was fine.




回答5:


Restart your Visual Studio and add the project again. Worked for me.




回答6:


IDE-integrated source control?




回答7:


You can try: file -> Source Control -> Go online




回答8:


Sounds like your source files are or have been under source control. Many source control systems will set files to read-only when they haven't been checked out for editing.

Total Commander makes it really easy to change file attributes recursively, but most likely Windows can also do this :)




回答9:


Much in line with what Morten Mertner said, (if you by chance are using TFS Source Control like I am) I did a manual checkout of the file and it resolved the issue for me.




回答10:


For me the problem is that the files are locked while the application is running.

In this state, Visual Studio 2013 displays the lock icon in the file tab and when you try to edit the file, a dialog box with this message appears:

Changes are not allowed for this module as it was not built for changes while debugging or the target .NET runtime version does not support it.

In Visual Studio 2015 as well, the lock icon appears in the file tab when the application is running. but the dialog box and message are not displayed.

Stopping the application causes the file to become unlocked.




回答11:


Close, then reopen the file.

Still a pain, but at least it's less costly than completely closing visual studio.



来源:https://stackoverflow.com/questions/2580825/my-project-in-visual-studio-is-read-only-what-did-i-do

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