开发者

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

开发者 https://www.devze.com 2022-12-25 23:09 出处:网络
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:\\My

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开发者_如何学C like that happened to you before?


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.

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

(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


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.


One Possible stupid thing.

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

How do I know. Guess..


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.


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


Close, then reopen the file.

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


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


IDE-integrated source control?


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 :)


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消