MVC应用程序构建速度极慢

时间:2013-06-27 10:59:26

标签: asp.net asp.net-mvc visual-studio visual-studio-2012 build

我正在开发Visual Studio MVC-4项目。构建解决方案大约需要2分钟,这没有任何意义。这是一个包含5个项目的小型解决方案,每个项目中的文件很少(少于几百个)。为了进行比较,我们有一个项目大小是这个项目(Web表单)的10-15倍,在我的计算机上构建不到3秒。

我听说我们从MVC2迁移到MVC4,团队记得迁移前解决方案要快得多,但他们无法完全记住它。

它不仅在我的计算机上,而且在团队中的其他计算机上。我很确定它是以某种方式存在于解决方案文件中。

我们只有1个帖子构建事件,它没有效果删除它。

关于该做什么的任何想法?

我尝试了什么

符号

我在这里读了一篇关于设置符号以在本地而不是服务器上运行的帖子。我做到了:

enter image description here

启用“仅我的代码” 确保只调试了我的代码:

enter image description here

删除临时文件夹

删除了计算机上所有不同的临时文件夹。

解决方案文件

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{C337490A-F7A8-4800-9BD3-668F5231AE2D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{58E3725E-75D2-4AB0-A693-D482152A28E5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Business", "Business", "{8999D8ED-77FD-42F4-A11A-F6F3B4224A41}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C1BC5D04-B71F-4E66-9C2F-352ED8A0AF84}"
    ProjectSection(SolutionItems) = preProject
        Saxo.Application.Publish.build = Saxo.Application.Publish.build
    EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Database", "Database", "{8F63871C-600E-49E5-9858-D3023485CD06}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Changescripts", "Changescripts", "{B3F72D6C-35EF-4D82-ACB9-5DCAE8F0BCA1}"
    ProjectSection(SolutionItems) = preProject
        30042013-DescriptionNotNull.sql = 30042013-DescriptionNotNull.sql
        AlterContentTextsAddAllowHtml.txt = AlterContentTextsAddAllowHtml.txt
        AlterInvoiceAccountsAddVismaSupplierId.sql = AlterInvoiceAccountsAddVismaSupplierId.sql
        AlterProjectsAddCategorySelfPublisher.sql = AlterProjectsAddCategorySelfPublisher.sql
    EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOMENAME", "SOMENAME", "{903F385F-C309-4189-BE1C-1598BEF9FBE6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOMENAME", "SOMENAME", "{797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOMENAME", "SOMENAME", "{BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOMENAME", "SOMENAME", "{EA172A15-6AE4-4358-8DB9-B75F6CC20458}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5E4C1C3C-AB57-49E6-8C7B-1E69CD3FBF67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOMENAME", "SOMENAME", "{97B74D41-8B99-4782-9B64-60BA180ED667}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Debug|Mixed Platforms = Debug|Mixed Platforms
        Debug|x86 = Debug|x86
        Release|Any CPU = Release|Any CPU
        Release|Mixed Platforms = Release|Mixed Platforms
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Debug|x86.ActiveCfg = Debug|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Release|Any CPU.Build.0 = Release|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {903F385F-C309-4189-BE1C-1598BEF9FBE6}.Release|x86.ActiveCfg = Release|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Debug|x86.ActiveCfg = Debug|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Release|Any CPU.Build.0 = Release|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85}.Release|x86.ActiveCfg = Release|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Debug|x86.ActiveCfg = Debug|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Release|Any CPU.Build.0 = Release|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8}.Release|x86.ActiveCfg = Release|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Debug|x86.ActiveCfg = Debug|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Release|Any CPU.Build.0 = Release|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458}.Release|x86.ActiveCfg = Release|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Debug|x86.ActiveCfg = Debug|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Release|Any CPU.Build.0 = Release|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {97B74D41-8B99-4782-9B64-60BA180ED667}.Release|x86.ActiveCfg = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(NestedProjects) = preSolution
        {BA8847A7-5EFB-4E1B-A689-4BBC4B6183D8} = {C337490A-F7A8-4800-9BD3-668F5231AE2D}
        {903F385F-C309-4189-BE1C-1598BEF9FBE6} = {58E3725E-75D2-4AB0-A693-D482152A28E5}
        {797DCD60-C9C4-4AB4-98FE-2CBB02AA4A85} = {8999D8ED-77FD-42F4-A11A-F6F3B4224A41}
        {EA172A15-6AE4-4358-8DB9-B75F6CC20458} = {8999D8ED-77FD-42F4-A11A-F6F3B4224A41}
        {B3F72D6C-35EF-4D82-ACB9-5DCAE8F0BCA1} = {8F63871C-600E-49E5-9858-D3023485CD06}
        {97B74D41-8B99-4782-9B64-60BA180ED667} = {5E4C1C3C-AB57-49E6-8C7B-1E69CD3FBF67}
    EndGlobalSection
EndGlobal

流程监控

我只运行过程监控器,只看cnc.exe。这是我的结果:

以下记录似乎又一次又一次地运行。

enter image description here

2 个答案:

答案 0 :(得分:10)

您的编译时间太长的一个可能原因是您已将<MvcBuildViews>设置为true,这将编译您的视图并提醒您视图中的任何语法错误。因为您可以拥有大量视图,所以此过程可以显着延长构建时间(分钟与秒)。 Here is a link to a site将解释如何关闭/打开MvcBuildViews属性。如果站点出现故障,您基本上将以下行添加到解决方案文件中:

启用

<MvcBuildViews>true</MvcBuildViews>

要停用

<MvcBuildViews>false</MvcBuildViews>

然而(自以为是的dia骂)我不同意你何时应该使用这个功能。他声明你应该只为Release / Production启用这个属性,而我认为你应该只为Debug配置启用它。大多数开发人员将在Debug中完全测试他们的Web应用程序,然后才切换到Release和push。为什么你不想在调试模式下进行编译时检查你正在做什么...调试和检查错误/错误?

答案 1 :(得分:9)

打开详细建筑。去 工具 - &gt;选项 - &gt;项目和解决方案 - &gt;构建并运行 将MS Build详细程度设置为Diagnostic。你应该看看花了多少时间。