Can I force Visual Studio (2010) to do a “Save All” when I build my solution?

心不动则不痛 提交于 2019-12-12 15:36:14

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/25250202/can-i-force-visual-studio-2010-to-do-a-save-all-when-i-build-my-solution

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