当我使用更改保存文件时,其状态会自动返回到未更改/已提交(蓝色锁定) [英] When I save a file with changes, its status automatically goes back to unchanged/committed (blue lock)

查看:186
本文介绍了当我使用更改保存文件时,其状态会自动返回到未更改/已提交(蓝色锁定)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中修改文件(cs / txt)时,它在解决方案资源管理器中的图标从蓝色锁变为红色v,但只要保存文件,图标就会回到蓝色锁,永远不要在团队资源管理器中提交任何更改。这个问题也影响到解决方案本身的变化。



有什么可能导致这种行为?

编辑:这是我的.gitignore文件的内容,我没有看到任何不寻常的东西。

  ##忽略Visual Studio临时文件,生成结果以及流行的Visual Studio附件生成的
##文件。

#特定于用户的文件
* .suo
* .user
* .sln.docstates

#生成结果

[Dd] ebug /
[Rr] elease /
x64 /
build /
[Bb] in /
[Oo] bj /

#在NuGet Packages文件夹中启用build /文件夹,因为NuGet软件包将它用于MSBuild目标
!packages / * / build /

#MSTest测试结果
[Tt] est [Rr] esult * /
[Bb] uild [Ll] og。*

* _i.c
* _p.c
* .ilk
* .meta
* .obj
* .pch
* .pdb
* .pgc
* .pgd
* .rsp
* .sbr
* .tlb
* .tli
* .tlh
* .tmp
* .tmp_proj
* .log
* .vspscc
* .vssscc
.builds
* .pidb
* .log
* .scc

#Visual C ++缓存文件
ipch /
* .aps
* .ncb
* .opensdf
* .sdf
* .cachefile

#Visual Studio分析器
* .psess
* .vsp
* .vspx

#制导自动化工具包
* .gpState

#ReSharper是一个.NET编码加载项
_ReSharper * /
*。[Rr] e [Ss ] harper

#TeamCity是一个构建插件
_TeamCity *

#DotCover是一个代码覆盖工具
* .dotCover

#NCrunch
* .ncrunch *
。* crunch * .local.xml

#Installshield输出文件夹
[Ee] xpress /

DocProject是文档生成器加载项
DocProject / buildhelp /
DocProject / Help / *。HxT
DocProject / Help / *。HxC
DocProject / Help / *。hhc
DocProject / Help / *。hhk
DocProject / Help / *。hhp
DocProject / Help / Html2
DocProject / Help / html

#一次性目录
发布/

#发布Web输出
* .Publish.xml

#NuGet包目录
## TODO:如果您启用了NuGet Package Restore,请取消注释下一行
#packages /

#Windows Azure Build输出
csx
* .build。 csdef

#Windows Store应用程序包目录
AppPackages /

#其他
sql /
* .Cache
ClientBin /
[Ss] tyle [Cc] op。*
〜$ *
*〜
* .dbmdl
*。[Pp] ublish.xml
* .pfx
* .publishsettings

#RIA / Silverlight项目
Generated_Code /

#备份&报告将旧的项目文件转换为新的
#Visual Studio版本的文件。不需要备份文件,因为我们有git ;-)
_UpgradeReport_Files /
备份* /
UpgradeLog * .XML
UpgradeLog * .htm

#SQL Server文件
* / App_Data / *。mdf
* / App_Data / *。ldf

$ b #LightSwitch生成的文件
GeneratedArtifacts /
_Pvt_Extensions /
ModelManifest.xml

#=========================
# Windows碎片
#=========================

#Windows映像文件缓存
大拇指.db
ehthumbs.db

#文件夹配置文件
Desktop.ini

#用于文件共享的回收站
$ RECYCLE。 BIN /

#Mac桌面服务商店文件
.DS_Store


解决方案

不知道这是否有帮助,但同样的事情发生在我身上。为了解决这个问题,我必须尝试两件事,我认为这两件事可能是导致它的组合,因为它们并没有解决它。奇怪的是,它只发生在我的解决方案中的三个项目中的一个。


  1. 注意到我的.gitattributes和.gitignore文件已经迁移到我的项目目录之一,而不是在解决方案文件夹的根目录下(我的解决方案中有多个项目)。当我将这两个文件移回存储库的根目录(与.git隐藏目录相同的目录)时。 编辑项目的文件夹属性。

  2. 从属性中选择高级并取消选中允许文件内容索引 - 将其应用于所有文件


VS突然识别改变并让我承诺;即使没有重新启动,这对我来说是第一次修复)



希望这有助于。


When I modify a file (cs/txt) in visual studio, its icon in solution explorer goes from blue lock to red v, but as soon as I save the file, the icon goes back to blue lock and there aren't ever any changes to commit in Team Explorer. This issue also affects changes to the solution itself.

What could possibly be causing this behavior?

Edit: This is the content of my .gitignore file, I don't see anything unusual

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*/App_Data/*.mdf
*/App_Data/*.ldf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

解决方案

Not sure if this helps but the same thing happened to me. To solve it, I had to try two things which I believe may be the combination which causes it because individually it did not solve it. What was odd was that it happened to only 1 of 3 projects in my solution.

  1. noticed that my .gitattributes and .gitignore files had migrated to one of my project directories instead of being at the root of the solution folder (I had multiple projects in my solution). When I moved the two files back to the root of the repository (same directory as the .git hidden directory).

  2. edit the folder properties for the project. Select Advanced from the Attributes and uncheck the "Allow files contents indexed" - apply this to all files

VS suddenly recognized the change and allowed me to commit; even with out restarting which is a first for a fix for me :)

Hope this helps.

这篇关于当我使用更改保存文件时,其状态会自动返回到未更改/已提交(蓝色锁定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆