Debugging Long Compile Times in App_Code directory
Asked Answered
M

3

6

I have a website based on the .NET 4.0 ASP.net project template. All of a sudden when I'm rebuilding my solution the App_Code directory takes awards of 3-4 minutes to compile (based on what is displayed in the Output window). There are only about 13 classes in this directory and they are all very small.

I've tried to move these files out of the App_Code directory to a separate class library project, but some of them depend on the System.Web.Security namespace which can't be added to a non-website project.

What is the best way to debug this to determine what is bogging-down the compile process?

Marcelmarcela answered 21/12, 2015 at 3:30 Comment(4)
I have turned on verbose debugging so that most information is written to the Output window, but it still gets to the "Building directory '/App_Code/'." message and hangs there for minutes sometimes. No further information is provided.Marcelmarcela
Is this a Web Site project or a Web Application project? If it's a Web Application project, then you don't have to have the code in App_Code, it can be in any folder of the website, so long as it's included in the project.Radloff
It's a Web Site project.Marcelmarcela
Well, probably not the advice you want to hear, but Web Site projects are evil, and should be discouraged. There are way too many failure and edge case scenarios.Radloff
D
1

In case you can't move app_code files due to web dependency to another project then moving them into the same project in another folder will not give you benefit.

  1. Website projects take awhile to build, longer then web app projects. So, see if you can convert it.

  2. You can also try setting optimizeCompilations="true" under compilation tag.

  3. Change the build project option to compile only the current page on run or debug

More referencence - https://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx

Dymoke answered 5/2, 2016 at 11:25 Comment(3)
Give me more details about it.. I might check it at my end as well.Dymoke
I spent hours trying to convert but the project was just too large and relied in the Profile system which isn't available in Web Application projects.Marcelmarcela
The only details I can provide are that there are 13 class in /App_Code and the directory sometimes minutes to compile (even though the classes are quite small).Marcelmarcela
M
1

Unfortunately the 'App_Code' directory is a black box and you can't watch compilation file-by-file. I tried to migrate to a Web Application template, but this was complicated by the fact that I rely on the Profile provider framework which isn't supported by default.

I think the best solution is to avoid this template entirely. I'm going to deal with the slow compile times until I can migrate entirely to MVC. This is especially important since .NET 5.0 (Core) will not support Web Forms at all.

Marcelmarcela answered 9/2, 2016 at 20:3 Comment(0)
M
0

try set property batch="false", In your Web.config file

< compilation debug="true" targetFramework="4.0" batch="false">

Multiplication answered 4/2, 2016 at 18:8 Comment(1)
This has no effect on compile times.Marcelmarcela

© 2022 - 2024 — McMap. All rights reserved.