CompilationSection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
웹 애플리케이션의 컴파일 인프라를 지원하는 데 사용되는 구성 설정을 정의합니다. 이 클래스는 상속할 수 없습니다.
public ref class CompilationSection sealed : System::Configuration::ConfigurationSection
public sealed class CompilationSection : System.Configuration.ConfigurationSection
type CompilationSection = class
inherit ConfigurationSection
Public NotInheritable Class CompilationSection
Inherits ConfigurationSection
- 상속
예제
이 예제에서는 클래스의 compilation 멤버로 액세스할 수도 있는 섹션의 여러 특성에 CompilationSection 대해 선언적으로 값을 지정하는 방법을 보여 줍니다.
다음 구성 파일 예제에서는 섹션에 대해 선언적으로 값을 지정하는 방법을 보여 있습니다 compilation .
<system.web>
<compilation
tempDirectory=""
debug="False"
strict="False"
explicit="True"
batch="True"
batchTimeout="900"
maxBatchSize="1000"
maxBatchGeneratedFileSize="1000"
numRecompilesBeforeAppRestart="15"
defaultLanguage="vb"
targetFramework="4.0"
urlLinePragmas="False"
assemblyPostProcessorType="">
<assemblies>
<clear />
</assemblies>
<buildProviders>
<clear />
</buildProviders>
<expressionBuilders>
<clear />
</expressionBuilders>
</compilation>
</system.web>
다음 코드 예제에서는 클래스의 멤버를 사용 하는 방법을 보여 줍니다 CompilationSection .
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
#endregion
namespace Samples.Aspnet.SystemWebConfiguration
{
class UsingCompilationSection
{
static void Main(string[] args)
{
try
{
// Set the path of the config file.
string configPath = "";
// Get the Web application configuration object.
Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);
// Get the section related object.
CompilationSection configSection =
(CompilationSection)config.GetSection("system.web/compilation");
// Display title and info.
Console.WriteLine("ASP.NET Configuration Info");
Console.WriteLine();
// Display Config details.
Console.WriteLine("File Path: {0}",
config.FilePath);
Console.WriteLine("Section Path: {0}",
configSection.SectionInformation.Name);
// Display Assemblies collection count.
Console.WriteLine("Assemblies Count: {0}",
configSection.Assemblies.Count);
// Display AssemblyPostProcessorType property.
Console.WriteLine("AssemblyPostProcessorType: {0}",
configSection.AssemblyPostProcessorType);
// Display Batch property.
Console.WriteLine("Batch: {0}", configSection.Batch);
// Set Batch property.
configSection.Batch = true;
// Display BatchTimeout property.
Console.WriteLine("BatchTimeout: {0}",
configSection.BatchTimeout);
// Set BatchTimeout property.
configSection.BatchTimeout = TimeSpan.FromMinutes(15);
// Display BuildProviders collection count.
Console.WriteLine("BuildProviders collection Count: {0}",
configSection.BuildProviders.Count);
// Display CodeSubDirectories collection count.
Console.WriteLine("CodeSubDirectories Count: {0}",
configSection.CodeSubDirectories.Count);
// Display Compilers collection count.
Console.WriteLine("Compilers Count: {0}",
configSection.Compilers.Count);
// Display Debug property.
Console.WriteLine("Debug: {0}",
configSection.Debug);
// Set Debug property.
configSection.Debug = false;
// Display DefaultLanguage property.
Console.WriteLine("DefaultLanguage: {0}",
configSection.DefaultLanguage);
// Set DefaultLanguage property.
configSection.DefaultLanguage = "vb";
// Display Explicit property.
Console.WriteLine("Explicit: {0}",
configSection.Explicit);
// Set Explicit property.
configSection.Explicit = true;
// Display ExpressionBuilders collection count.
Console.WriteLine("ExpressionBuilders Count: {0}",
configSection.ExpressionBuilders.Count);
// Display MaxBatchGeneratedFileSize property.
Console.WriteLine("MaxBatchGeneratedFileSize: {0}",
configSection.MaxBatchGeneratedFileSize);
// Set MaxBatchGeneratedFileSize property.
configSection.MaxBatchGeneratedFileSize = 1000;
// Display MaxBatchSize property.
Console.WriteLine("MaxBatchSize: {0}",
configSection.MaxBatchSize);
// Set MaxBatchSize property.
configSection.MaxBatchSize = 1000;
// Display NumRecompilesBeforeAppRestart property.
Console.WriteLine("NumRecompilesBeforeAppRestart: {0}",
configSection.NumRecompilesBeforeAppRestart);
// Set NumRecompilesBeforeAppRestart property.
configSection.NumRecompilesBeforeAppRestart = 15;
// Display Strict property.
Console.WriteLine("Strict: {0}",
configSection.Strict);
// Set Strict property.
configSection.Strict = false;
// Display TempDirectory property.
Console.WriteLine("TempDirectory: {0}", configSection.TempDirectory);
// Set TempDirectory property.
configSection.TempDirectory = "myTempDirectory";
// Display UrlLinePragmas property.
Console.WriteLine("UrlLinePragmas: {0}",
configSection.UrlLinePragmas);
// Set UrlLinePragmas property.
configSection.UrlLinePragmas = false;
// ExpressionBuilders Collection
int i = 1;
int j = 1;
foreach (ExpressionBuilder expressionBuilder in configSection.ExpressionBuilders)
{
Console.WriteLine();
Console.WriteLine("ExpressionBuilder {0} Details:", i);
Console.WriteLine("Type: {0}", expressionBuilder.ElementInformation.Type);
Console.WriteLine("Source: {0}", expressionBuilder.ElementInformation.Source);
Console.WriteLine("LineNumber: {0}", expressionBuilder.ElementInformation.LineNumber);
Console.WriteLine("Properties Count: {0}", expressionBuilder.ElementInformation.Properties.Count);
j = 1;
foreach (PropertyInformation propertyItem in expressionBuilder.ElementInformation.Properties)
{
Console.WriteLine("Property {0} Name: {1}", j, propertyItem.Name);
Console.WriteLine("Property {0} Value: {1}", j, propertyItem.Value);
j++;
}
i++;
}
// Update if not locked.
if (!configSection.SectionInformation.IsLocked)
{
config.Save();
Console.WriteLine("** Configuration updated.");
}
else
{
Console.WriteLine("** Could not update, section is locked.");
}
}
catch (Exception e)
{
// Unknown error.
Console.WriteLine(e.ToString());
}
// Display and wait
Console.ReadLine();
}
}
}
Imports System.Collections.Generic
Imports System.Text
Imports System.Configuration
Imports System.Web
Imports System.Web.Configuration
Namespace Samples.Aspnet.SystemWebConfiguration
Class UsingRoleManagerSection
Public Shared Sub Main()
Try
' Set the path of the config file.
Dim configPath As String = ""
' Get the Web application configuration object.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration(configPath)
' Get the section related object.
Dim configSection As System.Web.Configuration.CompilationSection = _
CType(config.GetSection("system.web/compilation"), _
System.Web.Configuration.CompilationSection)
' Display title and info.
Console.WriteLine("ASP.NET Configuration Info")
Console.WriteLine()
' Display Config details.
Console.WriteLine("File Path: {0}", _
config.FilePath)
Console.WriteLine("Section Path: {0}", _
configSection.SectionInformation.Name)
' Display Assemblies collection count.
Console.WriteLine("Assemblies Count: {0}", _
configSection.Assemblies.Count)
' Display AssemblyPostProcessorType property.
Console.WriteLine("AssemblyPostProcessorType: {0}", _
configSection.AssemblyPostProcessorType)
' Display Batch property.
Console.WriteLine("Batch: {0}", _
configSection.Batch)
' Set Batch property.
configSection.Batch = True
' Display BatchTimeout property.
Console.WriteLine("BatchTimeout: {0}", _
configSection.BatchTimeout)
' Set BatchTimeout property.
configSection.BatchTimeout = TimeSpan.FromMinutes(15)
' Display BuildProviders collection count.
Console.WriteLine("BuildProviders collection count: {0}", _
configSection.BuildProviders.Count)
' Display CodeSubDirectories property.
Console.WriteLine("CodeSubDirectories: {0}", _
configSection.CodeSubDirectories.Count)
' Display Compilers property.
Console.WriteLine("Compilers: {0}", _
configSection.Compilers.Count)
' Display Debug property.
Console.WriteLine("Debug: {0}", _
configSection.Debug)
' Set Debug property.
configSection.Debug = False
' Display DefaultLanguage property.
Console.WriteLine("DefaultLanguage: {0}", _
configSection.DefaultLanguage)
' Set DefaultLanguage property.
configSection.DefaultLanguage = "vb"
' Display Explicit property.
Console.WriteLine("Explicit: {0}", _
configSection.Explicit)
' Set Explicit property.
configSection.Explicit = True
' Display ExpressionBuilders collection count.
Console.WriteLine("ExpressionBuilders Count: {0}", _
configSection.ExpressionBuilders.Count)
' Display MaxBatchGeneratedFileSize property.
Console.WriteLine("MaxBatchGeneratedFileSize: {0}", _
configSection.MaxBatchGeneratedFileSize)
' Set MaxBatchGeneratedFileSize property.
configSection.MaxBatchGeneratedFileSize = 1000
' Display MaxBatchSize property.
Console.WriteLine("MaxBatchSize: {0}", _
configSection.MaxBatchSize)
' Set MaxBatchSize property.
configSection.MaxBatchSize = 1000
' Display NumRecompilesBeforeAppRestart property.
Console.WriteLine("NumRecompilesBeforeAppRestart: {0}", _
configSection.NumRecompilesBeforeAppRestart)
' Set NumRecompilesBeforeAppRestart property.
configSection.NumRecompilesBeforeAppRestart = 15
' Display Strict property.
Console.WriteLine("Strict: {0}", _
configSection.Strict)
' Set Strict property.
configSection.Strict = False
' Display TempDirectory property.
Console.WriteLine("TempDirectory: {0}", _
configSection.TempDirectory)
' Set TempDirectory property.
configSection.TempDirectory = "myTempDirectory"
' Display UrlLinePragmas property.
Console.WriteLine("UrlLinePragmas: {0}", _
configSection.UrlLinePragmas)
' Set UrlLinePragmas property.
configSection.UrlLinePragmas = False
' ExpressionBuilders Collection
Dim i = 1
Dim j = 1
For Each expressionBuilder As ExpressionBuilder In configSection.ExpressionBuilders()
Console.WriteLine()
Console.WriteLine("ExpressionBuilder {0} Details:", i)
Console.WriteLine("Type: {0}", expressionBuilder.ElementInformation.Type)
Console.WriteLine("Source: {0}", expressionBuilder.ElementInformation.Source)
Console.WriteLine("LineNumber: {0}", expressionBuilder.ElementInformation.LineNumber)
Console.WriteLine("Properties Count: {0}", expressionBuilder.ElementInformation.Properties.Count)
j = 1
For Each propertyItem As PropertyInformation In expressionBuilder.ElementInformation.Properties
Console.WriteLine("Property {0} Name: {1}", j, propertyItem.Name)
Console.WriteLine("Property {0} Value: {1}", j, propertyItem.Value)
j = j + 1
Next
i = i + 1
Next
' Update if not locked.
If Not configSection.SectionInformation.IsLocked Then
config.Save()
Console.WriteLine("** Configuration updated.")
Else
Console.WriteLine("** Could not update, section is locked.")
End If
Catch e As Exception
' Unknown error.
Console.WriteLine(e.ToString())
End Try
' Display and wait
Console.ReadLine()
End Sub
End Class
End Namespace
설명
클래스는 CompilationSection 프로그래밍 방식으로 액세스 하 고 구성 파일의 섹션의 콘텐츠를 수정 하는 compilation 방법을 제공 합니다.
생성자
| Name | Description |
|---|---|
| CompilationSection() |
기본 설정을 사용하여 클래스의 새 인스턴스를 CompilationSection 초기화합니다. |
속성
| Name | Description |
|---|---|
| Assemblies |
의 값을 AssemblyCollectionCompilationSection가져옵니다. |
| AssemblyPostProcessorType |
어셈블리에 대한 사후 프로세스 컴파일 단계를 지정하는 값을 가져오거나 설정합니다. |
| Batch |
일괄 처리 컴파일이 시도되었는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| BatchTimeout |
일괄 처리 컴파일의 제한 시간(초)을 가져오거나 설정합니다. |
| BuildProviders |
클래스의 BuildProviderCollectionCompilationSection 컬렉션을 가져옵니다. |
| CodeSubDirectories | |
| Compilers |
클래스의 CompilerCollectionCompilationSection 컬렉션을 가져옵니다. |
| ControlBuilderInterceptorType |
개체를 가로채고 컨테이너를 구성하는 데 사용되는 개체 형식을 나타내는 문자열을 ControlBuilder 가져오거나 설정합니다. |
| CurrentConfiguration |
현재 Configuration 인스턴스가 속한 구성 계층 구조를 나타내는 최상위 ConfigurationElement 인스턴스에 대한 참조를 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| Debug |
릴리스 이진 파일 또는 디버그 이진 파일을 컴파일할지 여부를 지정하는 값을 가져오거나 설정합니다. |
| DefaultLanguage |
동적 컴파일 파일에서 사용할 기본 프로그래밍 언어를 가져오거나 설정합니다. |
| DisableObsoleteWarnings |
컴파일 섹션의 "disableObsoleteWarnings" 구성 값이 설정되었는지 여부를 가져오거나 설정합니다. |
| ElementInformation |
사용자 지정할 수 없는 정보와 ElementInformation 개체의 기능이 포함된 ConfigurationElement 개체를 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| ElementProperty |
ConfigurationElementProperty 개체 자체를 나타내는 ConfigurationElement 개체를 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| EnablePrefetchOptimization |
ASP.NET 애플리케이션이 Windows 8 프리페치 기능을 활용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| EvaluationContext |
ContextInformation 개체에 대한 ConfigurationElement 개체를 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| Explicit |
Microsoft Visual Basic |
| ExpressionBuilders | |
| FolderLevelBuildProviders |
FolderLevelBuildProviderCollection 컴파일 중에 사용되는 빌드 공급자를 나타내는 클래스의 CompilationSection 컬렉션을 가져옵니다. |
| HasContext |
CurrentConfiguration 속성이 |
| Item[ConfigurationProperty] |
이 구성 요소의 속성 또는 특성을 가져오거나 설정합니다. (다음에서 상속됨 ConfigurationElement) |
| Item[String] |
이 구성 요소의 속성, 특성 또는 자식 요소를 가져오거나 설정합니다. (다음에서 상속됨 ConfigurationElement) |
| LockAllAttributesExcept |
잠긴 특성의 컬렉션을 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| LockAllElementsExcept |
잠긴 요소의 컬렉션을 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| LockAttributes |
잠긴 특성의 컬렉션을 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| LockElements |
잠긴 요소의 컬렉션을 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| LockItem |
요소가 잠겨 있는지 여부를 나타내는 값을 가져오거나 설정합니다. (다음에서 상속됨 ConfigurationElement) |
| MaxBatchGeneratedFileSize |
일괄 처리된 컴파일당 생성된 소스 파일의 최대 결합 크기를 가져오거나 설정합니다. |
| MaxBatchSize |
일괄 처리된 컴파일당 최대 페이지 수를 가져오거나 설정합니다. |
| MaxConcurrentCompilations |
컴파일 섹션의 "maxConcurrentCompilations" 구성 값이 설정되었는지 여부를 가져오거나 설정합니다. |
| NumRecompilesBeforeAppRestart |
애플리케이션을 다시 시작하기 전에 발생할 수 있는 리소스의 동적 다시 컴파일 수를 가져오거나 설정합니다. |
| OptimizeCompilations |
컴파일을 최적화해야 하는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| ProfileGuidedOptimizations |
애플리케이션이 배포된 환경에 최적화되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| Properties |
속성의 컬렉션을 가져옵니다. (다음에서 상속됨 ConfigurationElement) |
| SectionInformation |
개체의 SectionInformation 사용자 지정할 수 없는 정보 및 기능을 포함하는 개체를 ConfigurationSection 가져옵니다. (다음에서 상속됨 ConfigurationSection) |
| Strict |
Visual Basic |
| TargetFramework |
웹 사이트에서 대상으로 하는 .NET Framework의 버전을 가져오거나 설정합니다. |
| TempDirectory |
컴파일 중에 임시 파일 스토리지에 사용할 디렉터리를 지정하는 값을 가져오거나 설정합니다. |
| UrlLinePragmas |
컴파일러에 대한 명령이 실제 경로 또는 URL을 사용하는지 여부를 나타내는 값을 가져오거나 설정합니다. |