C# Class System.Web.WebPages.Deployment.WebPagesDeployment

显示文件 Open project: drivenet/aspnetwebstack Class Usage Examples

Public Methods

Method Description
GetAssemblyPath ( Version version ) : string

Gets full path to a folder that contains ASP.NET WebPages assemblies for a given version. Used by WebMatrix and Visual Studio so they know what to copy to an app's Bin folder or deploy to a hoster.

GetExplicitWebPagesVersion ( string path ) : Version
GetVersionWithoutEnabledCheck ( string path ) : Version In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered. If we are unable to determine a version, we would assume that this is a v1 app.
IsEnabled ( string path ) : bool

Determines if Asp.Net Web Pages is enabled. Web Pages is enabled if there's a webPages:Enabled key in AppSettings is set to "true" or if there's a cshtml file in the current path and the key is not present.

In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered.

IsExplicitlyDisabled ( string path ) : bool In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered.

Private Methods

Method Description
AppRootContainsWebPagesFile ( IFileSystem fileSystem, string path ) : bool
ForceRecompile ( IFileSystem fileSystem, string binDirectory ) : void
GetAppSettings ( string path ) : NameValueCollection
GetBinDirectory ( string path ) : string

HttpRuntime.BinDirectory is unavailable in design time and throws if we try to access it. To workaround this, if we aren't hosted, we will assume that the path that was passed to us is the application root.

GetCachedFileName ( ) : string

Name of the the temporary file used by BuildManager.CreateCachedFile / BuildManager.ReadCachedFile where we cache WebPages's version number.

GetEnabled ( NameValueCollection appSettings ) : bool?

Returns the value for webPages:Enabled AppSetting value in web.config.

GetIncompatibleDependencies ( string appPath ) : Version>.IDictionary
GetMaxVersion ( ) : Version
GetObsoleteVersionInternal ( string path, NameValueCollection configuration, IFileSystem fileSystem ) : Version This is meant to test an obsolete method. Don't use this!
GetPreviousRuntimeVersion ( IBuildManager buildManagerFileSystem ) : Version
GetVersion ( string path ) : Version
GetVersionFromConfig ( NameValueCollection appSettings ) : Version
GetVersionInternal ( NameValueCollection appSettings, Version binVersion, Version defaultVersion ) : Version

Returns the version of WebPages to be used for a specified path.

This method would always returns a value regardless of web pages is explicitly disabled (via config) or implicitly disabled (by virtue of not having a cshtml file) at the specified path.

GetVersionWithoutEnabledCheckInternal ( string path, Version defaultVersion ) : Version
GetWebPagesAssemblies ( ) : IEnumerable
IsEnabled ( IFileSystem fileSystem, string path, NameValueCollection appSettings ) : bool
IsExplicitlyDisabled ( NameValueCollection appSettings ) : bool
IsWebPagesFile ( string file ) : bool
PersistRuntimeVersion ( IBuildManager buildManager, Version version ) : void
RemoveTrailingSlash ( string path ) : string

Method Details

GetAssemblyPath() public static method

Gets full path to a folder that contains ASP.NET WebPages assemblies for a given version. Used by WebMatrix and Visual Studio so they know what to copy to an app's Bin folder or deploy to a hoster.
public static GetAssemblyPath ( Version version ) : string
version Version
return string

GetExplicitWebPagesVersion() public static method

public static GetExplicitWebPagesVersion ( string path ) : Version
path string
return Version

GetVersionWithoutEnabledCheck() public static method

In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered. If we are unable to determine a version, we would assume that this is a v1 app.
public static GetVersionWithoutEnabledCheck ( string path ) : Version
path string Physical or virtual path to a directory where we need to determine the version of WebPages to be used.
return Version

IsEnabled() public static method

Determines if Asp.Net Web Pages is enabled. Web Pages is enabled if there's a webPages:Enabled key in AppSettings is set to "true" or if there's a cshtml file in the current path and the key is not present.
In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered.
public static IsEnabled ( string path ) : bool
path string The path at which to determine if web pages is enabled.
return bool

IsExplicitlyDisabled() public static method

In a non-hosted scenario, this method would only look at a web.config that is present at the current path. Any config settings at an ancestor directory would not be considered.
public static IsExplicitlyDisabled ( string path ) : bool
path string
return bool