本文整理汇总了C#中System.Web.VirtualPath.CombineWithAppRoot方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.CombineWithAppRoot方法的具体用法?C# VirtualPath.CombineWithAppRoot怎么用?C# VirtualPath.CombineWithAppRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.VirtualPath
的用法示例。
在下文中一共展示了VirtualPath.CombineWithAppRoot方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTopLevelAssemblyReferences
internal string[] GetTopLevelAssemblyReferences(VirtualPath virtualPath)
{
this.AddPendingCall();
List<Assembly> fromList = new List<Assembly>();
try
{
virtualPath.CombineWithAppRoot();
foreach (AssemblyInfo info in MTConfigUtil.GetCompilationConfig(virtualPath).Assemblies)
{
Assembly[] assemblyInternal = info.AssemblyInternal;
for (int i = 0; i < assemblyInternal.Length; i++)
{
if (assemblyInternal[i] != null)
{
fromList.Add(assemblyInternal[i]);
}
}
}
}
finally
{
this.RemovePendingCall();
}
StringCollection toList = new StringCollection();
Util.AddAssembliesToStringCollection(fromList, toList);
string[] array = new string[toList.Count];
toList.CopyTo(array, 0);
return array;
}
示例2: GetCompiledTypeAndAssemblyName
internal string[] GetCompiledTypeAndAssemblyName(VirtualPath virtualPath, ClientBuildManagerCallback callback)
{
string[] strArray;
this.AddPendingCall();
try
{
virtualPath.CombineWithAppRoot();
Type compiledType = BuildManager.GetCompiledType(virtualPath, callback);
if (compiledType == null)
{
return null;
}
string assemblyPathFromType = Util.GetAssemblyPathFromType(compiledType);
strArray = new string[] { compiledType.FullName, assemblyPathFromType };
}
finally
{
this.RemovePendingCall();
}
return strArray;
}
示例3: GetCompilerParamsAndBuildProvider
private System.Web.Compilation.BuildProvider GetCompilerParamsAndBuildProvider(VirtualPath virtualPath, out Type codeDomProviderType, out CompilerParameters compilerParameters)
{
virtualPath.CombineWithAppRoot();
CompilationSection compilationConfig = MTConfigUtil.GetCompilationConfig(virtualPath);
ICollection referencedAssemblies = BuildManager.GetReferencedAssemblies(compilationConfig);
System.Web.Compilation.BuildProvider provider = null;
if (StringUtil.EqualsIgnoreCase(virtualPath.VirtualPathString, BuildManager.GlobalAsaxVirtualPath.VirtualPathString))
{
ApplicationBuildProvider provider2 = new ApplicationBuildProvider();
provider2.SetVirtualPath(virtualPath);
provider2.SetReferencedAssemblies(referencedAssemblies);
provider = provider2;
}
else
{
provider = BuildManager.CreateBuildProvider(virtualPath, compilationConfig, referencedAssemblies, true);
}
provider.IgnoreParseErrors = true;
provider.IgnoreControlProperties = true;
provider.ThrowOnFirstParseError = false;
CompilerType codeCompilerType = provider.CodeCompilerType;
if (codeCompilerType == null)
{
codeDomProviderType = null;
compilerParameters = null;
return null;
}
codeDomProviderType = codeCompilerType.CodeDomProviderType;
compilerParameters = codeCompilerType.CompilerParameters;
IAssemblyDependencyParser assemblyDependencyParser = provider.AssemblyDependencyParser;
if ((assemblyDependencyParser != null) && (assemblyDependencyParser.AssemblyDependencies != null))
{
Util.AddAssembliesToStringCollection(assemblyDependencyParser.AssemblyDependencies, compilerParameters.ReferencedAssemblies);
}
AssemblyBuilder.FixUpCompilerParameters(codeDomProviderType, compilerParameters);
return provider;
}
示例4: GetCodeDirectoryInformation
internal void GetCodeDirectoryInformation(VirtualPath virtualCodeDir, out Type codeDomProviderType, out CompilerParameters compParams, out string generatedFilesDir)
{
this.AddPendingCall();
try
{
BuildManager.SkipTopLevelCompilationExceptions = true;
this._buildManager.EnsureTopLevelFilesCompiled();
virtualCodeDir = virtualCodeDir.CombineWithAppRoot();
this._buildManager.GetCodeDirectoryInformation(virtualCodeDir, out codeDomProviderType, out compParams, out generatedFilesDir);
}
finally
{
BuildManager.SkipTopLevelCompilationExceptions = false;
this.RemovePendingCall();
}
}
示例5: GetCompilerParamsAndBuildProvider
private BuildProvider GetCompilerParamsAndBuildProvider(VirtualPath virtualPath,
out Type codeDomProviderType, out CompilerParameters compilerParameters) {
virtualPath.CombineWithAppRoot();
CompilationSection compConfig = MTConfigUtil.GetCompilationConfig(virtualPath);
ICollection referencedAssemblies = BuildManager.GetReferencedAssemblies(compConfig);
// Create the buildprovider for the passed in virtualPath
BuildProvider buildProvider = null;
// Special case global asax build provider here since we do not want to compile every files with ".asax" extension.
if (StringUtil.EqualsIgnoreCase(virtualPath.VirtualPathString, BuildManager.GlobalAsaxVirtualPath.VirtualPathString)) {
ApplicationBuildProvider provider = new ApplicationBuildProvider();
provider.SetVirtualPath(virtualPath);
provider.SetReferencedAssemblies(referencedAssemblies);
buildProvider = provider;
}
else {
buildProvider = BuildManager.CreateBuildProvider(virtualPath, compConfig,
referencedAssemblies, true /*failIfUnknown*/);
}
// DevDiv 69017
// The methods restricted to internalBuildProvider have been moved up to BuildProvider
// to allow WCFBuildProvider to support .svc syntax highlighting.
// Ignore parse errors, since they should not break the designer
buildProvider.IgnoreParseErrors = true;
// Ignore all control properties, since we do not generate code for the properties
buildProvider.IgnoreControlProperties = true;
// Process as many errors as possible, do not rethrow on first error
buildProvider.ThrowOnFirstParseError = false;
// Get the language (causes the file to be parsed)
CompilerType compilerType = buildProvider.CodeCompilerType;
// compilerType could be null in the no-compile case (VSWhidbey 221749)
if (compilerType == null) {
codeDomProviderType = null;
compilerParameters = null;
return null;
}
// Return the provider type and compiler params
codeDomProviderType = compilerType.CodeDomProviderType;
compilerParameters = compilerType.CompilerParameters;
IAssemblyDependencyParser parser = buildProvider.AssemblyDependencyParser;
// Add all the assemblies that the page depends on (e.g. user controls)
if (parser != null && parser.AssemblyDependencies != null) {
Util.AddAssembliesToStringCollection(parser.AssemblyDependencies,
compilerParameters.ReferencedAssemblies);
}
// Make any fix up adjustments to the CompilerParameters to work around some issues
AssemblyBuilder.FixUpCompilerParameters(compConfig, codeDomProviderType, compilerParameters);
return buildProvider;
}
示例6: GetTopLevelAssemblyReferences
/*
* Returns an array of the assemblies defined in the bin and assembly reference config section
*/
internal String[] GetTopLevelAssemblyReferences(VirtualPath virtualPath) {
// Add a pending call to make sure our thread doesn't get killed
AddPendingCall();
List<Assembly> assemblyList = new List<Assembly>();
try {
// Treat it as relative to the app root
virtualPath.CombineWithAppRoot();
CompilationSection compConfig = MTConfigUtil.GetCompilationConfig(virtualPath);
// Add all the config assemblies to the list
foreach (AssemblyInfo assemblyInfo in compConfig.Assemblies) {
Assembly[] assemblies = assemblyInfo.AssemblyInternal;
for (int i = 0; i < assemblies.Length; i++) {
if (assemblies[i] != null) {
assemblyList.Add(assemblies[i]);
}
}
}
} finally {
RemovePendingCall();
}
StringCollection paths = new StringCollection();
Util.AddAssembliesToStringCollection(assemblyList, paths);
string[] references = new string[paths.Count];
paths.CopyTo(references, 0);
return references;
}
示例7: GetCompiledTypeAndAssemblyName
internal string[] GetCompiledTypeAndAssemblyName(VirtualPath virtualPath, ClientBuildManagerCallback callback) {
// Add a pending call to make sure our thread doesn't get killed
AddPendingCall();
try {
// Treat it as relative to the app root
virtualPath.CombineWithAppRoot();
Type t = BuildManager.GetCompiledType(virtualPath, callback);
if (t == null) return null;
string assemblyPath = Util.GetAssemblyPathFromType(t);
return new string[] { t.FullName, assemblyPath };
}
finally {
RemovePendingCall();
}
}
示例8: GetCodeDirectoryInformation
internal void GetCodeDirectoryInformation(VirtualPath virtualCodeDir,
out Type codeDomProviderType, out CompilerParameters compParams,
out string generatedFilesDir) {
// Add a pending call to make sure our thread doesn't get killed
AddPendingCall();
try {
BuildManager.SkipTopLevelCompilationExceptions = true;
_buildManager.EnsureTopLevelFilesCompiled();
// Treat it as relative to the app root
virtualCodeDir = virtualCodeDir.CombineWithAppRoot();
_buildManager.GetCodeDirectoryInformation(virtualCodeDir,
out codeDomProviderType, out compParams, out generatedFilesDir);
}
finally {
BuildManager.SkipTopLevelCompilationExceptions = false;
RemovePendingCall();
}
}