问题
While programming, the longest part is a build on my ASP.NET Website project is the "Building directory" process seen below. (Note: I don't have the liberty to turn this into a Web Application with a .csproj build file. Wish I did.)
The contents of the directories seen below are not changing although there might be some dependencies in the App_Code/ subfolders that do change.
Is there any way for me to stop some directories from building using Web.config, to shorten a compile of my dev copy? It's the only viable file I can think of to use without having an official build file.
------ Build started: Project: C:\...\cmsappmin-abcd\, Configuration: Debug Any CPU ------
Validating Web Site
Building directory '/cmsappmin-abcd/abcd/controls/docsearch/'.
Building directory '/cmsappmin-abcd/abcd/controls/'.
Building directory '/cmsappmin-abcd/abcd/controls/pipco/'.
Building directory '/cmsappmin-abcd/abcd/controls/reg1000/'.
Building directory '/cmsappmin-abcd/abcd/TemplateC/'.
Building directory '/cmsappmin-abcd/abcd/Template/'.
回答1:
Right click on the website project in solution explorer, and select property pages.
Under Build, change the following settings:
- Start action/Before running startup page - No Build
- Build solution action - uncheck "Build Web site as part of solution"
That will stop Visual Studio from building any pages when performing a build. When WebDev.Webserver starts, your pages will now be built as and when you access each directory.
来源:https://stackoverflow.com/questions/2360310/prevent-asp-net-website-project-from-building-certain-directories-by-using-web-c