本文整理汇总了C#中FrameworkName类的典型用法代码示例。如果您正苦于以下问题:C# FrameworkName类的具体用法?C# FrameworkName怎么用?C# FrameworkName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FrameworkName类属于命名空间,在下文中一共展示了FrameworkName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public bool Execute(string installPath, string scriptFileName, IPackage package, Project project, FrameworkName targetFramework, ILogger logger)
{
string scriptPath, fullPath;
if (package.FindCompatibleToolFiles(scriptFileName, targetFramework, out scriptPath))
{
fullPath = Path.Combine(installPath, scriptPath);
}
else
{
return false;
}
if (File.Exists(fullPath))
{
string toolsPath = Path.GetDirectoryName(fullPath);
string logMessage = String.Format(CultureInfo.CurrentCulture, VsResources.ExecutingScript, fullPath);
// logging to both the Output window and progress window.
logger.Log(MessageLevel.Info, logMessage);
IConsole console = OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: true);
Host.Execute(console,
"[email protected](); $input|%{$__pc_args+=$_}; & " + PathHelper.EscapePSPath(fullPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2] $__pc_args[3]; Remove-Variable __pc_args -Scope 0",
new object[] { installPath, toolsPath, package, project });
return true;
}
return false;
}
示例2: BuildProjectSystem
public BuildProjectSystem(string root, FrameworkName targetFramework, ITaskItem[] currentReferences)
: base(root)
{
_targetFramework = targetFramework;
_currentReferences = currentReferences;
OutputReferences = new List<string>();
}
示例3: InstallWalker
public InstallWalker(IPackageRepository localRepository,
IPackageRepository sourceRepository,
IPackageConstraintProvider constraintProvider,
FrameworkName targetFramework,
ILogger logger,
bool ignoreDependencies,
bool allowPrereleaseVersions)
: base(targetFramework)
{
if (sourceRepository == null)
{
throw new ArgumentNullException("sourceRepository");
}
if (localRepository == null)
{
throw new ArgumentNullException("localRepository");
}
if (logger == null)
{
throw new ArgumentNullException("logger");
}
Repository = localRepository;
Logger = logger;
SourceRepository = sourceRepository;
_ignoreDependencies = ignoreDependencies;
ConstraintProvider = constraintProvider;
_operations = new OperationLookup();
_allowPrereleaseVersions = allowPrereleaseVersions;
}
示例4: GetDescription
public LibraryDescription GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
{
if (!libraryRange.IsGacOrFrameworkReference)
{
return null;
}
var name = libraryRange.GetReferenceAssemblyName();
var version = libraryRange.VersionRange?.MinVersion;
string path;
Version assemblyVersion;
if (!FrameworkResolver.TryGetAssembly(name, targetFramework, out path, out assemblyVersion))
{
return null;
}
if (version == null || version.Version == assemblyVersion)
{
return new LibraryDescription(
libraryRange,
new LibraryIdentity(libraryRange.Name, new SemanticVersion(assemblyVersion), isGacOrFrameworkReference: true),
path,
LibraryTypes.ReferenceAssembly,
Enumerable.Empty<LibraryDependency>(),
new[] { name },
framework: targetFramework);
}
return null;
}
示例5: ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var stringValue = (string) value;
if (!String.IsNullOrEmpty(stringValue))
{
string[] parts = stringValue.Split(new[] {';', ','}, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length > 0)
{
var names = new FrameworkName[parts.Length];
for (int i = 0; i < parts.Length; i++)
{
try
{
names[i] = VersionUtility.ParseFrameworkName(parts[i]);
if (names[i] == VersionUtility.UnsupportedFrameworkName)
{
return DependencyProperty.UnsetValue;
}
}
catch (ArgumentException)
{
return DependencyProperty.UnsetValue;
}
}
return names;
}
}
return new FrameworkName[0];
}
示例6: FakePackageManagementProject
public FakePackageManagementProject(string name)
{
FakeInstallPackageAction = new FakeInstallPackageAction(this);
FakeUninstallPackageAction = new FakeUninstallPackageAction(this);
this.Name = name;
ConstraintProvider = NullConstraintProvider.Instance;
TargetFramework = new FrameworkName(".NETFramework", new Version("4.0"));
InstallPackageAction = (package, installAction) => {
PackagePassedToInstallPackage = package;
PackageOperationsPassedToInstallPackage = installAction.Operations;
IgnoreDependenciesPassedToInstallPackage = installAction.IgnoreDependencies;
AllowPrereleaseVersionsPassedToInstallPackage = installAction.AllowPrereleaseVersions;
};
UpdatePackageAction = (package, updateAction) => {
PackagePassedToUpdatePackage = package;
PackageOperationsPassedToUpdatePackage = updateAction.Operations;
UpdateDependenciesPassedToUpdatePackage = updateAction.UpdateDependencies;
AllowPrereleaseVersionsPassedToUpdatePackage = updateAction.AllowPrereleaseVersions;
IsUpdatePackageCalled = true;
};
}
示例7: GetActiveProject
private bool GetActiveProject(out EnvDTE.Project project, out FrameworkName frameworkName)
{
project = null;
frameworkName = null;
IntPtr hierarchyPointer = IntPtr.Zero;
IntPtr selectionContainerPointer = IntPtr.Zero;
try
{
uint itemid;
IVsMultiItemSelect multiItemSelect;
Marshal.ThrowExceptionForHR(
_monitorSelection.GetCurrentSelection(
out hierarchyPointer,
out itemid,
out multiItemSelect,
out selectionContainerPointer));
if (itemid != (uint)VSConstants.VSITEMID.Root)
{
return false;
}
var hierarchy = Marshal.GetObjectForIUnknown(hierarchyPointer) as IVsHierarchy;
if (hierarchy == null)
{
return false;
}
object extensibilityObject;
object targetFrameworkVersion;
object targetFrameworkMonikerObject;
Marshal.ThrowExceptionForHR(
hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out extensibilityObject));
Marshal.ThrowExceptionForHR(
hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID3.VSHPROPID_TargetFrameworkVersion, out targetFrameworkVersion));
Marshal.ThrowExceptionForHR(
hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID4.VSHPROPID_TargetFrameworkMoniker, out targetFrameworkMonikerObject));
string targetFrameworkMoniker = targetFrameworkMonikerObject as string;
frameworkName = new System.Runtime.Versioning.FrameworkName(targetFrameworkMoniker);
project = extensibilityObject as EnvDTE.Project;
return true;
}
finally
{
if (hierarchyPointer != IntPtr.Zero)
{
Marshal.Release(hierarchyPointer);
}
if (selectionContainerPointer != IntPtr.Zero)
{
Marshal.Release(selectionContainerPointer);
}
}
}
示例8: GetDependencies
public async Task<IEnumerable<LibraryDependency>> GetDependencies(WalkProviderMatch match, FrameworkName targetFramework)
{
using (var stream = await _source.OpenNuspecStreamAsync(new PackageInfo
{
Id = match.Library.Name,
Version = match.Library.Version,
ContentUri = match.Path
}))
{
var metadata = (IPackageMetadata)Manifest.ReadFrom(stream, validateSchema: false).Metadata;
IEnumerable<PackageDependencySet> dependencySet;
if (VersionUtility.TryGetCompatibleItems(targetFramework, metadata.DependencySets, out dependencySet))
{
return dependencySet
.SelectMany(ds => ds.Dependencies)
.Select(d => new LibraryDependency
{
LibraryRange = new LibraryRange
{
Name = d.Id,
VersionRange = d.VersionSpec == null ? null : new SemanticVersionRange(d.VersionSpec)
}
})
.ToList();
}
}
return Enumerable.Empty<LibraryDependency>();
}
示例9: PublishRuntime
public PublishRuntime(PublishRoot root, FrameworkName frameworkName, string runtimePath)
{
_frameworkName = frameworkName;
_runtimePath = runtimePath;
Name = new DirectoryInfo(_runtimePath).Name;
TargetPath = Path.Combine(root.TargetRuntimesPath, Name);
}
示例10: SelectFrameworkNameForRuntime
public static FrameworkName SelectFrameworkNameForRuntime(IEnumerable<FrameworkName> availableFrameworks, FrameworkName currentFramework, string runtime)
{
// Filter out frameworks incompatible with the current framework before selecting
return SelectFrameworkNameForRuntime(
availableFrameworks.Where(f => VersionUtility.IsCompatible(currentFramework, f)),
runtime);
}
示例11: GetRootEditorSetting
internal static string GetRootEditorSetting(ModelTreeManager modelTreeManager, FrameworkName targetFramework)
{
Debug.Assert(modelTreeManager != null, "modelTreeManager is null.");
Debug.Assert(targetFramework != null, "targetFramework is null.");
string globalEditorSetting = null;
if (Is45OrHigher(targetFramework))
{
if (modelTreeManager != null)
{
ModelItem rootItem = modelTreeManager.Root;
if (rootItem != null)
{
object root = rootItem.GetCurrentValue();
globalEditorSetting = ExpressionActivityEditor.GetExpressionActivityEditor(root);
if (string.IsNullOrEmpty(globalEditorSetting))
{
globalEditorSetting = VBExpressionLanguageName;
}
}
}
}
else
{
// When the target framework is less than 4.5, the root setting is ignored and always return VB
globalEditorSetting = VBExpressionLanguageName;
}
return globalEditorSetting;
}
示例12: GetDisplayName
public static string GetDisplayName(FrameworkName version)
{
var normalized = VersionUtility.GetShortFrameworkName(version);
// HACKS :)
if (version.Profile.Equals("WindowsPhone", StringComparison.InvariantCultureIgnoreCase)
&& version.Identifier.Equals("Silverlight", StringComparison.InvariantCultureIgnoreCase)
&& version.Version.Major == 3) {
return "Windows Phone 7";
}
// MORE HACKS
var result = normalized;
result = Regex.Replace(result, @"^net(?=\d)", ".NET ");
result = Regex.Replace(result, @"(\d+(?:\.\d+)*)-cf$", "CF $1");
result = Regex.Replace(result, @"^(sl\d)\d$", "$1"); // Silverlight normally uses one digit
result = Regex.Replace(result, @"^sl(?=\d)", "Silverlight ");
result = Regex.Replace(result, @"^wp(?=\d)", "Windows Phone ");
result = Regex.Replace(result, @"^wp$", "Windows Phone");
result = Regex.Replace(result, @"^win(dows)?(8(0)?)?$", "Windows 8", RegexOptions.ExplicitCapture);
result = Regex.Replace(result, @"^win81$", "Windows 8.1");
result = Regex.Replace(result, @"\d{2,}", match => string.Join(".", match.Value.ToCharArray())); // 45 => 4.5, etc
result = Regex.Replace(result, @"-Client", " (Client Profile)");
return result;
}
示例13: GetDescription
public LibraryDescription GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
{
if (libraryRange.IsGacOrFrameworkReference)
{
return null;
}
if (!DependencyTargets.SupportsProject(libraryRange.Target))
{
return null;
}
string name = libraryRange.Name;
Runtime.Project project;
// Can't find a project file with the name so bail
if (!_projectResolver.TryResolveProject(name, out project))
{
return null;
}
// This never returns null
var targetFrameworkInfo = project.GetCompatibleTargetFramework(targetFramework);
var dependencies = project.Dependencies.Concat(targetFrameworkInfo.Dependencies).ToList();
return new ProjectDescription(
libraryRange,
project,
dependencies,
Enumerable.Empty<string>(),
targetFrameworkInfo,
resolved: true);
}
示例14: TryGetAssembly
public bool TryGetAssembly(string name, FrameworkName targetFramework, out string path, out Version version)
{
path = null;
version = null;
var information = _cache.GetOrAdd(targetFramework, GetFrameworkInformation);
if (information == null || !information.Exists)
{
return false;
}
lock (information.Assemblies)
{
AssemblyEntry entry;
if (information.Assemblies.TryGetValue(name, out entry))
{
if (string.IsNullOrEmpty(entry.Path))
{
entry.Path = GetAssemblyPath(information.SearchPaths, name);
}
if (!string.IsNullOrEmpty(entry.Path) && entry.Version == null)
{
// This code path should only run on mono
entry.Version = VersionUtility.GetAssemblyVersion(entry.Path).Version;
}
path = entry.Path;
version = entry.Version;
}
}
return !string.IsNullOrEmpty(path);
}
示例15: ReferenceTable
internal ReferenceTable(bool findDependencies, bool findSatellites, bool findSerializationAssemblies, bool findRelatedFiles, string[] searchPaths, string[] allowedAssemblyExtensions, string[] relatedFileExtensions, string[] candidateAssemblyFiles, string[] frameworkPaths, InstalledAssemblies installedAssemblies, System.Reflection.ProcessorArchitecture targetProcessorArchitecture, Microsoft.Build.Shared.FileExists fileExists, Microsoft.Build.Shared.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, OpenBaseKey openBaseKey, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, Version projectTargetFramework, FrameworkName targetFrameworkMoniker, TaskLoggingHelper log, string[] latestTargetFrameworkDirectories, bool copyLocalDependenciesWhenParentReferenceInGac, CheckIfAssemblyInGac checkIfAssemblyIsInGac)
{
this.log = log;
this.findDependencies = findDependencies;
this.findSatellites = findSatellites;
this.findSerializationAssemblies = findSerializationAssemblies;
this.findRelatedFiles = findRelatedFiles;
this.frameworkPaths = frameworkPaths;
this.allowedAssemblyExtensions = allowedAssemblyExtensions;
this.relatedFileExtensions = relatedFileExtensions;
this.installedAssemblies = installedAssemblies;
this.targetProcessorArchitecture = targetProcessorArchitecture;
this.fileExists = fileExists;
this.directoryExists = directoryExists;
this.getDirectories = getDirectories;
this.getAssemblyName = getAssemblyName;
this.getAssemblyMetadata = getAssemblyMetadata;
this.getRuntimeVersion = getRuntimeVersion;
this.projectTargetFramework = projectTargetFramework;
this.targetedRuntimeVersion = targetedRuntimeVersion;
this.openBaseKey = openBaseKey;
this.targetFrameworkMoniker = targetFrameworkMoniker;
this.latestTargetFrameworkDirectories = latestTargetFrameworkDirectories;
this.copyLocalDependenciesWhenParentReferenceInGac = copyLocalDependenciesWhenParentReferenceInGac;
this.checkIfAssemblyIsInGac = checkIfAssemblyIsInGac;
this.compiledSearchPaths = AssemblyResolution.CompileSearchPaths(searchPaths, candidateAssemblyFiles, targetProcessorArchitecture, frameworkPaths, fileExists, getAssemblyName, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, openBaseKey, installedAssemblies, getRuntimeVersion, targetedRuntimeVersion);
}