WPF 项目文件夹文件膨胀

huangapple go评论62阅读模式
英文:

WPF Project Folder File Bloat

问题

我每天在Visual Studio 2022中工作我的WPF项目,并在晚上备份我的项目文件夹。我不禁注意到那里的文件数量一直在增加(每天增加数百个),即使我没有向项目中添加新内容。这导致备份时间和在工作站之间传输文件所需的时间变得越来越长。

是什么在生成这些额外的文件,是否有减少它们的方法?

我在网络上寻找答案,但没有成功。

感谢您能给我的任何建议。

英文:

I work on my WPF project daily in Visual Studio 2022, and back-up my project folder in the evening. I can't help but notice the number of files in there just keeps getting greater (by hundreds every day), even when I'm not adding anything new to the project. It's causing back-up time, and the time it takes to transfer my files between workstations, to get longer and longer.

What could be generating these extra files and is there a way to minimize it?

I've had a look around the net for answers, but to no avail.

Thanks for all and any advice you can give me.

答案1

得分: 2

使用GitHub仓库是解决问题的最佳方式。
转到Git Studio菜单,选择其中的创建仓库项目,将您的解决方案上传到创建的仓库,需要时提交更改。
除了仅仅备份,这还允许您轻松方便地比较不同版本。

如果出于某种原因,这对您来说不方便,那么请注意仓库中的忽略文件。此文件中的所有模板文件和文件夹都不需要备份。

这是来自我的仓库的忽略文件链接:https://github.com/EldHasp/CyberForumMyCycleRepos/blob/master/.gitignore

在最简单的情况下,所有以点开头的文件夹、bin、obj和packages文件夹都不需要保存。

英文:

The best way to solve your problem is using the GitHub Repository.
Go to the Git Studio menu, select the create repository item in it, upload your Solution to the created Repository, commit the changes when you need it.
In addition to just backing up, this will allow you to easily and conveniently compare different versions.

If for some reason this is inconvenient for you, then pay attention to the ignore file in the Repository. All templated files and folders in this file do not require backup.

Here is a link to the ignore file from my Repository: https://github.com/EldHasp/CyberForumMyCycleRepos/blob/master/.gitignore

In the most minimal variant, all folders whose names begin with a dot, the bin, obj and packages folders do not require saving.

答案2

得分: 0

  1. 尝试在发布模式下编译,而不是调试模式。
  2. 尝试清空 obj 和 bin 文件夹。
  3. 关闭自动生成 XML。

更新:
我猜测你正在以调试模式运行程序,而你的程序可能导致一些文件增长。有以下方法来清理 obj 文件夹:

  1. 右键单击项目,选择清理,然后重新构建。
  2. 将以下代码添加到预构建事件中,这样在每次构建之前都会清理 obj 文件夹,但这个操作会删除之前的 obj 文件夹。
rmdir /s /q "$(ProjectDir)obj"
英文:

Try the following:

  1. Try compiling in release mode instead of debug mode.
  2. Try clearing the obj and bin folders
  3. Turn off the automatic generation of xml.

Update:
My guess is that you are running your program in debug mode and your program is causing some files to grow.
There are the following methods to clean up the obj folder:

  1. Right-click the project and select clean, then rebuild
  2. Add the following code into the pre-build event, so that the obj folder will be cleaned up before each build, but this operation will delete the previous obj folder.
rmdir /s /q "$(ProjectDir)obj"

huangapple
  • 本文由 发表于 2023年2月6日 08:12:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75356389.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定