我可以强制 Visual Studio (2010) 执行“全部保存"吗?当我构建我的解决方案时? [英] Can I force Visual Studio (2010) to do a "Save All" when I build my solution?

查看:32
本文介绍了我可以强制 Visual Studio (2010) 执行“全部保存"吗?当我构建我的解决方案时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Visual Studio 2010 反复感到沮丧.我将向项目添加新文件、构建、运行测试 - 一切都很好.然后我将提交并推送我的更改(我正在使用 GitExtensions 和 GitHub)

最后,我将退出 Visual Studio - 并被询问是否要保存对 MyProject.csproj 的更改.果然,保存更改后,.csproj 文件现在在 GitExtensions 中显示本地修改 - 这意味着之前的提交/推送实际上推送了损坏的代码,因为我推送了没有相应 .csproj 文件引用的新文件.这一切都是因为当您向项目添加新文件时,Visual Studio 实际上并没有保存您的 .csproj 文件 - 尽管它似乎很高兴地编译它而您的更改尚未保存到磁盘......>

有什么方法可以强制 Visual Studio 在我添加新文件时执行全部保存" - 或者每当我运行一些频繁的命令时,例如构建解决方案?

解决方案

查看Tools --> Options --> Projects and Solutions --> Build And Run --> Before Build (Save all changes) 选项.

更高版本的 VS (2012+) 应始终在构建时保存您的项目.

I have a recurring frustration with Visual Studio 2010. I'll add a new file to a project, build, run tests - all good. Then I'll commit and push my changes (I'm using GitExtensions and GitHub)

Finally, I'll exit Visual Studio - and get asked if I want to save changes to MyProject.csproj. Sure enough, after saving changes, the .csproj file now shows local modifications in GitExtensions - which means the previous commit/push actually pushed broken code, because I'd pushed the new file without the corresponding .csproj file reference. All because Visual Studio doesn't actually save your .csproj file when you add new files to your project - although it seems to compile it quite happily without your changes being saved to disk yet...

Is there any way I can force Visual Studio to do a "save all" whenever I add a new file - or whenever I run some frequent command, like building the solution?

解决方案

Look under Tools --> Options --> Projects and Solutions --> Build And Run --> Before Building (Save all changes) for the option.

Later versions of VS (2012+) should always save your projects when building.

这篇关于我可以强制 Visual Studio (2010) 执行“全部保存"吗?当我构建我的解决方案时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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