Visual Studio 22缓慢的构建时间
我们正在使用Visual Studio 22使用ASP.NET Core 6进行一个项目,并且
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe
构建过程中的构建过程已成功,但速度很慢。建立大约1分钟30秒的时间。 如何减少构建过程时间? 任何帮助都将不胜感激。
we are working on a project with asp.net core 6 using Visual studio 22 and the build process stuck in
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe
the build done successfuly ,but its slow . build time about 1 minute and 30 seconds.
how to reduce build process time?
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在VS2022中的大麻店工作,每个变化都需要重新编译或部分兼容(热重新加载),这很慢。
我建议使用以下更改来加快构建时间。
CPU
获得高涡轮钟速率的处理器,约为4GHz-5GHz。
如果您正在运行笔记本电脑,请尝试获取以H字母结尾的Intel处理器。例如,最新的英特尔CPU为12700h/12900h。这些是疯狂的快速笔记本电脑处理器,可以胜过许多台式机CPU。
确保您的计算机使用Windows Performance配置文件或同等用品,以免CPU被限制以节省电源。
磁盘
一等奖是第四代NVME驱动器与支持Gen4 NVME的计算机配对。二等奖是任何NVME驱动器。
加密
一等奖是不使用磁盘加密,但是如果确实需要它,则选择硬件加密,因为软件加密会消耗CPU资源,而少量编译则较少。硬件加密使用SSD自己的内部加密(始终是活动)来处理加密。
我自己的测试通过软件加密导致 +-40%的写入性能损失。
RAM
只需确保您有足够的RAM,并且Windows不会将内存交换为磁盘以编译您的项目。因此,大多数人通常16GB RAM就足够了,但是我个人更喜欢拥有32GB,因此内存中的Windows会缓存更多。
VS2022
在构建过程中禁用视觉工作室分析仪。有些人报告关闭时的构建时间增加。
I am working on Blazor in vs2022 and every change requires recompilation or partial-compilation (hot reload) which was painfully slow.
The following changes I recommend for speeding up build times.
CPU
Get a processor with high turbo clock rate, around 4GHZ-5GHZ.
If you are running a laptop, try get an Intel processor that ends with the H letter. For example, the latest Intel CPUs are 12700H/12900H. These are insanely fast laptop processors which can outperform many desktop CPUs.
Ensure your computer is using the Windows Performance profile or equivalent so that your CPU is not being throttled to save power.
DISK
First prize is a 4th GEN NVME drive paired with a computer that supports GEN4 NVME. Second prize is any NVME drive.
ENCRYPTION
First prize is not to use disk encryption, but if you do need it, opt for hardware encryption as software encryption will consume CPU resources leaving less for compiling. Hardware encryption uses the SSD's own internal encryption (which is always active) to handle the encryption.
My own testing has resulted in +- 40% loss in write performance with software encryption.
RAM
Just make sure you have enough RAM and Windows is not swapping memory to disk in order to compile your project. So most often 16GB RAM is sufficient, but I personally prefer to have 32GB so that more is cached by Windows in memory.
VS2022
Disable visual studio analyzers during build. Some have reported build times increase when this is turned off.
我遇到了这个问题,并在构建过程中关闭了分析仪。右键单击项目,然后选择属性。然后单击代码分析,然后取消选中框。
I had this issue and turning off the analyzers during the build resolved it. Right click on the project and select properties. Then click Code Analysis, and uncheck the box.
对我来说,这是针对Nuget设置
工具 - > Nuget软件包经理 - >软件包maneger设置
在此处输入图像描述
for me it was for nuget setting
Tools -> NuGet Package Manager -> Package Maneger Settings
enter image description here