本文整理汇总了C#中Microsoft.Build.Shared.AssemblyNameExtension类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyNameExtension类的具体用法?C# AssemblyNameExtension怎么用?C# AssemblyNameExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyNameExtension类属于Microsoft.Build.Shared命名空间,在下文中一共展示了AssemblyNameExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public override bool Resolve(AssemblyNameExtension assemblyName, string rawFileNameCandidate, bool isPrimaryProjectReference, bool wantSpecificVersion, string[] executableExtensions, string hintPath, string assemblyFolderKey, ArrayList assembliesConsideredAndRejected, out string foundPath, out bool userRequestedSpecificFile)
{
foundPath = null;
userRequestedSpecificFile = false;
if (rawFileNameCandidate != null)
{
if (base.fileExists(rawFileNameCandidate))
{
userRequestedSpecificFile = true;
foundPath = rawFileNameCandidate;
return true;
}
if (assembliesConsideredAndRejected != null)
{
ResolutionSearchLocation location = null;
location = new ResolutionSearchLocation {
FileNameAttempted = rawFileNameCandidate,
SearchPath = base.searchPathElement,
Reason = NoMatchReason.NotAFileNameOnDisk
};
assembliesConsideredAndRejected.Add(location);
}
}
return false;
}
示例2: ResolveFromDirectory
/// <summary>
/// Resolve a reference to a specific file name.
/// </summary>
/// <param name="assemblyName">The assemblyname of the reference.</param>
/// <param name="rawFileNameCandidate">The reference's 'include' treated as a raw file name.</param>
/// <param name="isPrimaryProjectReference">Whether or not this reference was directly from the project file (and therefore not a dependency)</param>
/// <param name="wantSpecificVersion">Whether an exact version match is requested.</param>
/// <param name="executableExtensions">Allowed executable extensions.</param>
/// <param name="hintPath">The item's hintpath value.</param>
/// <param name="assemblyFolderKey">Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.</param>
/// <param name="assembliesConsideredAndRejected">Receives the list of locations that this function tried to find the assembly. May be "null".</param>
/// <param name="foundPath">The path where the file was found.</param>
/// <param name="userRequestedSpecificFile">Whether or not the user wanted a specific file (for example, HintPath is a request for a specific file)</param>
/// <returns>True if the file was resolved.</returns>
public override bool Resolve
(
AssemblyNameExtension assemblyName,
string sdkName,
string rawFileNameCandidate,
bool isPrimaryProjectReference,
bool wantSpecificVersion,
string[] executableExtensions,
string hintPath,
string assemblyFolderKey,
ArrayList assembliesConsideredAndRejected,
out string foundPath,
out bool userRequestedSpecificFile
)
{
foundPath = null;
userRequestedSpecificFile = false;
// Resolve to the given path.
string resolvedPath = ResolveFromDirectory(assemblyName, isPrimaryProjectReference, wantSpecificVersion, executableExtensions, searchPathElement, assembliesConsideredAndRejected);
if (resolvedPath != null)
{
foundPath = resolvedPath;
return true;
}
return false;
}
示例3: Resolve
public override bool Resolve(AssemblyNameExtension assemblyName, string rawFileNameCandidate, bool isPrimaryProjectReference, bool wantSpecificVersion, string[] executableExtensions, string hintPath, string assemblyFolderKey, ArrayList assembliesConsideredAndRejected, out string foundPath, out bool userRequestedSpecificFile)
{
foundPath = null;
userRequestedSpecificFile = false;
if (assemblyName != null)
{
string path = GlobalAssemblyCache.GetLocation(assemblyName, base.targetProcessorArchitecture, base.getRuntimeVersion, base.targetedRuntimeVersion, false, base.fileExists, null, null, wantSpecificVersion);
if (((path != null) && (path.Length > 0)) && base.fileExists(path))
{
foundPath = path;
return true;
}
if (assembliesConsideredAndRejected != null)
{
ResolutionSearchLocation location = new ResolutionSearchLocation {
FileNameAttempted = assemblyName.FullName,
SearchPath = base.searchPathElement,
AssemblyName = assemblyName,
Reason = NoMatchReason.NotInGac
};
assembliesConsideredAndRejected.Add(location);
}
}
return false;
}
示例4:
/// <summary>
/// Resolve a reference to a specific file name.
/// </summary>
/// <param name="assemblyName">The assemblyname of the reference.</param>
/// <param name="rawFileNameCandidate">The reference's 'include' treated as a raw file name.</param>
/// <param name="isPrimaryProjectReference">Whether or not this reference was directly from the project file (and therefore not a dependency)</param>
/// <param name="wantSpecificVersion">Whether an exact version match is requested.</param>
/// <param name="executableExtensions">Allowed executable extensions.</param>
/// <param name="hintPath">The item's hintpath value.</param>
/// <param name="assemblyFolderKey">Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.</param>
/// <param name="assembliesConsideredAndRejected">Receives the list of locations that this function tried to find the assembly. May be "null".</param>
/// <param name="foundPath">The path where the file was found.</param>
/// <param name="userRequestedSpecificFile">Whether or not the user wanted a specific file (for example, HintPath is a request for a specific file)</param>
/// <returns>True if the file was resolved.</returns>
public override bool Resolve
(
AssemblyNameExtension assemblyName,
string sdkName,
string rawFileNameCandidate,
bool isPrimaryProjectReference,
bool wantSpecificVersion,
string[] executableExtensions,
string hintPath,
string assemblyFolderKey,
ArrayList assembliesConsideredAndRejected,
out string foundPath,
out bool userRequestedSpecificFile
)
{
if (hintPath != null && hintPath.Length > 0)
{
if (ResolveAsFile(hintPath, assemblyName, isPrimaryProjectReference, wantSpecificVersion, true, assembliesConsideredAndRejected))
{
userRequestedSpecificFile = true;
foundPath = hintPath;
return true;
}
}
foundPath = null;
userRequestedSpecificFile = false;
return false;
}
示例5: Execute
public override bool Execute()
{
FrameworkName frameworkmoniker = null;
FrameworkName name2 = null;
bool flag = false;
try
{
frameworkmoniker = new FrameworkName(this.TargetFrameworkMoniker);
flag = !string.IsNullOrEmpty(frameworkmoniker.Profile);
if (flag)
{
name2 = new FrameworkName(frameworkmoniker.Identifier, frameworkmoniker.Version);
}
if ((!this.bypassFrameworkInstallChecks && frameworkmoniker.Identifier.Equals(".NETFramework", StringComparison.OrdinalIgnoreCase)) && (frameworkmoniker.Version.Major < 4))
{
if (!net35SP1SentinelAssemblyFound.HasValue)
{
AssemblyNameExtension strongName = new AssemblyNameExtension(NET35SP1SentinelAssemblyName);
net35SP1SentinelAssemblyFound = new bool?(!string.IsNullOrEmpty(GlobalAssemblyCache.GetLocation(strongName, System.Reflection.ProcessorArchitecture.MSIL, runtimeVersion => "v2.0.50727", new Version("2.0.57027"), false, new Microsoft.Build.Shared.FileExists(Microsoft.Build.Shared.FileUtilities.FileExistsNoThrow), GlobalAssemblyCache.pathFromFusionName, GlobalAssemblyCache.gacEnumerator, false)));
}
if (!net35SP1SentinelAssemblyFound.Value)
{
base.Log.LogErrorWithCodeFromResources("GetReferenceAssemblyPaths.NETFX35SP1NotIntstalled", new object[] { this.TargetFrameworkMoniker });
}
}
}
catch (ArgumentException exception)
{
base.Log.LogErrorWithCodeFromResources("GetReferenceAssemblyPaths.InvalidTargetFrameworkMoniker", new object[] { this.TargetFrameworkMoniker, exception.Message });
return false;
}
try
{
this.tfmPaths = this.GetPaths(this.rootPath, frameworkmoniker);
if ((this.tfmPaths != null) && (this.tfmPaths.Count > 0))
{
this.TargetFrameworkMonikerDisplayName = ToolLocationHelper.GetDisplayNameForTargetFrameworkDirectory(this.tfmPaths[0], frameworkmoniker);
}
if (flag && (this.tfmPaths != null))
{
this.tfmPathsNoProfile = this.GetPaths(this.rootPath, name2);
}
if (!flag)
{
this.tfmPathsNoProfile = this.tfmPaths;
}
}
catch (Exception exception2)
{
base.Log.LogErrorWithCodeFromResources("GetReferenceAssemblyPaths.ProblemGeneratingReferencePaths", new object[] { this.TargetFrameworkMoniker, exception2.Message });
if (Microsoft.Build.Shared.ExceptionHandling.IsCriticalException(exception2))
{
throw;
}
this.tfmPathsNoProfile = null;
this.TargetFrameworkMonikerDisplayName = null;
}
return !base.Log.HasLoggedErrors;
}
示例6: foreach
/// <summary>
/// Implementation guts for ResolveReference.
/// </summary>
/// <param name="jaggedResolvers">The array of resolvers to search with.</param>
/// <param name="assemblyName">The assembly name to look up.</param>
/// <param name="rawFileNameCandidate">The file name to match if {RawFileName} is seen. (May be null).</param>
/// <param name="isPrimaryProjectReference">True if this is a primary reference directly from the project file.</param>
/// <param name="executableExtensions">The filename extension of the assembly. Must be this or its no match.</param>
/// <param name="hintPath">This reference's hintpath</param>
/// <param name="assemblyFolderKey">Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.</param>
/// <param name="assembliesConsideredAndRejected">Receives the list of locations that this function tried to find the assembly. May be "null".</param>
/// <param name="resolvedSearchPath">Receives the searchPath that the reference was resolved at. Empty if not resolved.</param>
/// <param name="userRequestedSpecificFile"> This will be true if the user requested a specific file.</param>
/// <returns>The resolved path</returns>
internal static string ResolveReference
(
IEnumerable<Resolver[]> jaggedResolvers,
AssemblyNameExtension assemblyName,
string sdkName,
string rawFileNameCandidate,
bool isPrimaryProjectReference,
bool wantSpecificVersion,
string[] executableExtensions,
string hintPath,
string assemblyFolderKey,
ArrayList assembliesConsideredAndRejected,
out string resolvedSearchPath,
out bool userRequestedSpecificFile
)
{
// Initialize outs.
userRequestedSpecificFile = false;
resolvedSearchPath = String.Empty;
// Search each group of resolvers
foreach (Resolver[] resolvers in jaggedResolvers)
{
// Tolerate null resolvers.
if (resolvers == null)
{
break;
}
// Search each searchpath.
foreach (Resolver resolver in resolvers)
{
string fileLocation;
if
(
resolver.Resolve
(
assemblyName,
sdkName,
rawFileNameCandidate,
isPrimaryProjectReference,
wantSpecificVersion,
executableExtensions,
hintPath,
assemblyFolderKey,
assembliesConsideredAndRejected,
out fileLocation,
out userRequestedSpecificFile
)
)
{
resolvedSearchPath = resolver.SearchPath;
return fileLocation;
}
}
}
return null;
}
示例7: CheckForFullFusionNameInGac
private static string CheckForFullFusionNameInGac(AssemblyNameExtension assemblyName, string targetProcessorArchitecture, GetPathFromFusionName getPathFromFusionName)
{
string fullName = assemblyName.FullName;
if ((targetProcessorArchitecture != null) && !assemblyName.HasProcessorArchitectureInFusionName)
{
fullName = fullName + ", ProcessorArchitecture=" + targetProcessorArchitecture;
}
return getPathFromFusionName(fullName);
}
示例8: CheckForAssemblyInGac
private bool CheckForAssemblyInGac(AssemblyNameExtension assemblyName, System.Reflection.ProcessorArchitecture targetProcessorArchitecture, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, Microsoft.Build.Shared.FileExists fileExists)
{
string str = null;
if (assemblyName.Version != null)
{
str = GlobalAssemblyCache.GetLocation(assemblyName, targetProcessorArchitecture, getRuntimeVersion, targetedRuntimeVersion, true, fileExists, null, null, false);
}
return (str != null);
}
示例9: UnifiedAssemblyName
public UnifiedAssemblyName(AssemblyNameExtension preUnified, AssemblyNameExtension postUnified, bool isUnified, UnificationReason unificationReason, bool isPrerequisite, bool? isRedistRoot, string redistName)
{
_preUnified = preUnified;
_postUnified = postUnified;
_isUnified = isUnified;
_isPrerequisite = isPrerequisite;
_isRedistRoot = isRedistRoot;
_redistName = redistName;
_unificationReason = unificationReason;
}
示例10: UnifiedAssemblyName
public UnifiedAssemblyName(AssemblyNameExtension preUnified, AssemblyNameExtension postUnified, bool isUnified, Microsoft.Build.Tasks.UnificationReason unificationReason, bool isPrerequisite, bool? isRedistRoot, string redistName)
{
this.preUnified = preUnified;
this.postUnified = postUnified;
this.isUnified = isUnified;
this.isPrerequisite = isPrerequisite;
this.isRedistRoot = isRedistRoot;
this.redistName = redistName;
this.unificationReason = unificationReason;
}
示例11: GetAssemblyMetadata
private void GetAssemblyMetadata(string path, out AssemblyNameExtension[] dependencies, out string[] scatterFiles)
{
FileState fileState = this.GetFileState(path);
if (fileState.dependencies == null)
{
this.getAssemblyMetadata(path, out fileState.dependencies, out fileState.scatterFiles);
this.isDirty = true;
}
dependencies = fileState.dependencies;
scatterFiles = fileState.scatterFiles;
}
示例12: FindHighestVersionInRedistList
internal AssemblyEntry FindHighestVersionInRedistList(AssemblyNameExtension assemblyName)
{
foreach (AssemblyEntry entry in this.redistList.FindAssemblyNameFromSimpleName(assemblyName.Name))
{
if (entry.AssemblyNameExtension.EqualsIgnoreVersion(assemblyName))
{
return entry;
}
}
return null;
}
示例13: GetLocation
internal static string GetLocation(AssemblyNameExtension strongName, ProcessorArchitecture targetProcessorArchitecture, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, bool fullFusionName, Microsoft.Build.Shared.FileExists fileExists, GetPathFromFusionName getPathFromFusionName, GetGacEnumerator getGacEnumerator, bool specificVersion)
{
string str = null;
if (((strongName.GetPublicKeyToken() == null) || (strongName.GetPublicKeyToken().Length == 0)) && (strongName.FullName.IndexOf("PublicKeyToken", StringComparison.OrdinalIgnoreCase) != -1))
{
return str;
}
getPathFromFusionName = getPathFromFusionName ?? pathFromFusionName;
getGacEnumerator = getGacEnumerator ?? gacEnumerator;
if (!strongName.HasProcessorArchitectureInFusionName)
{
if ((targetProcessorArchitecture != ProcessorArchitecture.MSIL) && (targetProcessorArchitecture != ProcessorArchitecture.None))
{
string str2 = ResolveAssemblyReference.ProcessorArchitectureToString(targetProcessorArchitecture);
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, str2, getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, str2, getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
}
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, "MSIL", getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, "MSIL", getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
}
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, null, getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, null, getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
return null;
}
示例14: AddToDependencyGraph
private static void AddToDependencyGraph(Dictionary<Reference, List<ReferenceAssemblyExtensionPair>> dependencyGraph, AssemblyNameExtension assemblyName, Reference assemblyReference)
{
foreach (Reference reference in assemblyReference.GetDependees())
{
List<ReferenceAssemblyExtensionPair> list = null;
if (!dependencyGraph.TryGetValue(reference, out list))
{
list = new List<ReferenceAssemblyExtensionPair>();
dependencyGraph.Add(reference, list);
}
list.Add(new ReferenceAssemblyExtensionPair(assemblyReference, assemblyName));
}
}
示例15:
/// <summary>
/// Resolve a reference to a specific file name.
/// </summary>
/// <param name="assemblyName">The assemblyname of the reference.</param>
/// <param name="sdkName">The name of the sdk to resolve.</param>
/// <param name="rawFileNameCandidate">The reference's 'include' treated as a raw file name.</param>
/// <param name="isPrimaryProjectReference">Whether or not this reference was directly from the project file (and therefore not a dependency)</param>
/// <param name="wantSpecificVersion">Whether an exact version match is requested.</param>
/// <param name="executableExtensions">Allowed executable extensions.</param>
/// <param name="hintPath">The item's hintpath value.</param>
/// <param name="assemblyFolderKey">Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.</param>
/// <param name="assembliesConsideredAndRejected">Receives the list of locations that this function tried to find the assembly. May be "null".</param>
/// <param name="foundPath">The path where the file was found.</param>
/// <param name="userRequestedSpecificFile">Whether or not the user wanted a specific file (for example, HintPath is a request for a specific file)</param>
/// <returns>True if the file was resolved.</returns>
abstract public bool Resolve
(
AssemblyNameExtension assemblyName,
string sdkName,
string rawFileNameCandidate,
bool isPrimaryProjectReference,
bool wantSpecificVersion,
string[] executableExtensions,
string hintPath,
string assemblyFolderKey,
ArrayList assembliesConsideredAndRejected,
out string foundPath,
out bool userRequestedSpecificFile
);