VS 2010 中 C# 项目的构建速度意外缓慢
我正在开发一个非常简单的 C# 解决方案,包含两个项目:一个类库和一个库的安装程序。构建类库本身大约需要一秒钟的时间。然而,构建安装程序需要花费不可预测/令人难以置信的长时间。更有趣的是,CPU 似乎在编译期间“休息”,使单个核心达到峰值 5 到 10 秒,然后在几秒钟内达到接近 0 的值。
安装程序项目非常简单。它只是类库的输出(一个 DLL,大约 2MB)和一些注册表项。
有什么想法可能会导致这种情况吗?
I'm working on a pretty simple C# solution with two projects: a class library and an installer for the library. Building the class library itself takes about a second. Building the installer, however, takes an unpredictably/incredibly long time. More interestingly, the CPU appears to be "taking breaks" during compilation, spiking a single core for 5 to 10 seconds and then hitting near-0 for several seconds.
The installer project is pretty simple. It's just the output from the class library (a single DLL, about 2MB) and a few registry keys.
Any ideas what could cause this?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们遇到了这个确切的问题,发现 msi 构建过程会在 c:\Documents and Settings\username\Local Settings\Temp 文件夹中创建 vsi*.tmp 文件,这些文件不会被清理,因此会随着时间的推移而累积。存在的这些文件越多,创建 msi 所需的时间就越长。我们通过使用计划任务删除任何>的文件来解决我们的问题。 24小时了。
注意 - 对于我们的情况,服务器是 Windows Server 2003 R2 - 因此是 c:\Documents and Settings 前缀。如果您使用的是 Windows Vista 或 Windows 7,您可能会通过在 c:\Users\username 下搜索 vsi*.tmp 来找到这些文件。
We had this exact problem and found that the msi build process creates vsi*.tmp files in the c:\Documents and Settings\username\Local Settings\Temp folder which are not cleaned up, and thus build up over time. The more of these files that exist, the longer the msi creation takes. We solved our problem by using a scheduled task to delete any of those files that are > 24 hours old.
Note - for our situation the server was Windows Server 2003 R2 - hence the c:\Documents and Settings prefix. If you are using Windows Vista or Windows 7, you'll probably find the files by searching for vsi*.tmp under c:\Users\username instead.
如果有人在谷歌上偶然发现这个问题,并且其他解决方案似乎都无法解决您的问题,并且您像我一样将工作放在 USB 驱动器上......请不要使用 USB 驱动器。虽然您只在 TFS 中设置一个工作区,然后将 USB 拖到周围,但这是不值得的。只需在本地驱动器上创建另一个工作区,并仅在需要时使用 USB。
If anyone stumbles across this question on google and none of the other solutions seem to solve your problem and you like myself had your work on a usb drive ... dont use the usb drive . Although you only then setup one workspace in TFS and then drag the usb around its not worth it. Just create another workspace on your local drive and only use the usb when needed.
经过一段时间的修改后,我发现将 COM 的 Register 设置更改为 NOT REGISTER,有利于让 DLL 构建执行注册,安装程序构建变得更加可靠(并且更快)。我不确定这是否是一个解决方案,因为 COM 注册应该可以简单地工作。但是,我至少能够解决这个问题。
After tinkering with things for awhile, I found that changing the Register setting to NOT REGISTER for COM in favor of having the DLL build perform the registration, the installer build became much more reliable (and faster). I'm not sure this constitutes a solution, since COM registration should simply work. But, I've at least been able to work around the issue.