当前位置: 首页>>代码示例>>C#>>正文


C# TargetFrameworkMoniker类代码示例

本文整理汇总了C#中TargetFrameworkMoniker的典型用法代码示例。如果您正苦于以下问题:C# TargetFrameworkMoniker类的具体用法?C# TargetFrameworkMoniker怎么用?C# TargetFrameworkMoniker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TargetFrameworkMoniker类属于命名空间,在下文中一共展示了TargetFrameworkMoniker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FakeDotNetProject

		public FakeDotNetProject ()
		{
			References = new ProjectReferenceCollection ();
			Files = new ProjectFileCollection ();
			TargetFrameworkMoniker = new TargetFrameworkMoniker ("v4.5");
			CreateEqualsAction ();
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:FakeDotNetProject.cs

示例2: TargetFramework

		internal TargetFramework (TargetFrameworkMoniker id)
		{
			this.id = id;
			this.name = id.Profile == null
				? string.Format ("{0} {1}", id.Identifier, id.Version)
				: string.Format ("{0} {1} {2} Profile", id.Identifier, id.Version, id.Profile);
			clrVersion = ClrVersion.Default;
			Assemblies = new AssemblyInfo[0];
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:9,代码来源:TargetFramework.cs

示例3: MSBuildFileFormat

		public MSBuildFileFormat (string productVersion, string toolsVersion, string slnVersion, string productDescription,
			TargetFrameworkMoniker[] frameworkVersions, bool supportsMonikers)
		{
			this.productVersion = productVersion;
			this.toolsVersion = toolsVersion;
			this.slnVersion = slnVersion;
			this.productDescription = productDescription;
			this.frameworkVersions = frameworkVersions;
			this.supportsMonikers = supportsMonikers;
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:10,代码来源:MSBuildFileFormat.cs

示例4: OnReadProjectHeader

		protected override void OnReadProjectHeader (ProgressMonitor monitor, MSBuildProject msproject)
		{
			base.OnReadProjectHeader (monitor, msproject);

			compileTarget = msproject.EvaluatedProperties.GetValue<CompileTarget> ("OutputType");
			defaultNamespace = msproject.EvaluatedProperties.GetValue ("RootNamespace", string.Empty);
			usePartialTypes = msproject.EvaluatedProperties.GetValue ("UsePartialTypes", true);

			string frameworkIdentifier = msproject.EvaluatedProperties.GetValue ("TargetFrameworkIdentifier");
			string frameworkVersion = msproject.EvaluatedProperties.GetValue ("TargetFrameworkVersion");
			string frameworkProfile = msproject.EvaluatedProperties.GetValue ("TargetFrameworkProfile");

			//determine the default target framework from the project type's default
			//overridden by the components in the project
			var def = GetDefaultTargetFrameworkForFormat (ToolsVersion);
			var targetFx = new TargetFrameworkMoniker (
				string.IsNullOrEmpty (frameworkIdentifier)? def.Identifier : frameworkIdentifier,
				string.IsNullOrEmpty (frameworkVersion)? def.Version : frameworkVersion,
				string.IsNullOrEmpty (frameworkProfile)? def.Profile : frameworkProfile);


			string fx = ExtendedProperties ["InternalTargetFrameworkVersion"] as string;
			if (!string.IsNullOrEmpty (fx)) {
				targetFx = TargetFrameworkMoniker.Parse (fx);
				ExtendedProperties.Remove ("InternalTargetFrameworkVersion");
			}

			TargetFramework = Runtime.SystemAssemblyService.GetTargetFramework (targetFx);
		}
开发者ID:ArsenShnurkov,项目名称:monodevelop,代码行数:29,代码来源:DotNetProject.cs

示例5: GetTargetFramework

		public TargetFramework GetTargetFramework (TargetFrameworkMoniker id)
		{
			TargetFramework fx;
			if (frameworks.TryGetValue (id, out fx))
				return fx;

			LoggingService.LogDebug ("Unregistered TargetFramework '{0}' is being requested from SystemAssemblyService, ensuring rutimes initialized and trying again", id);
			foreach (var r in runtimes)
				r.EnsureInitialized ();
			if (frameworks.TryGetValue (id, out fx))
				return fx;
			
			LoggingService.LogWarning ("Unregistered TargetFramework '{0}' is being requested from SystemAssemblyService, returning empty TargetFramework", id);
			UpdateFrameworks (new [] { new TargetFramework (id) });
			return frameworks [id];
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:16,代码来源:SystemAssemblyService.cs

示例6: GetTargetFramework

		public TargetFramework GetTargetFramework (TargetFrameworkMoniker id)
		{
			TargetFramework fx;
			if (frameworks.TryGetValue (id, out fx))
				return fx;
			LoggingService.LogWarning ("Unregistered TargetFramework '{0}' is being requested from SystemAssemblyService", id);
			UpdateFrameworks (new [] { new TargetFramework (id) });
			return frameworks [id];
		}
开发者ID:fedorw,项目名称:monodevelop,代码行数:9,代码来源:SystemAssemblyService.cs

示例7: FindTargetFrameworks

		protected static IEnumerable<TargetFramework> FindTargetFrameworks (FilePath frameworksDirectory, bool rescanKnownFrameworks)
		{
			foreach (FilePath idDir in Directory.GetDirectories (frameworksDirectory)) {
				var id = idDir.FileName;
				foreach (FilePath versionDir in Directory.GetDirectories (idDir)) {
					var version = versionDir.FileName;
					var moniker = new TargetFrameworkMoniker (id, version);
					if (rescanKnownFrameworks || !Runtime.SystemAssemblyService.IsKnownFramework (moniker)) {
						var fx = ReadTargetFramework (moniker, versionDir);
						if (fx != null)
							yield return (fx);
					}
					var profileListDir = versionDir.Combine ("Profile");
					if (!Directory.Exists (profileListDir))
						continue;
					foreach (FilePath profileDir in Directory.GetDirectories (profileListDir)) {
						var profile = profileDir.FileName;
						moniker = new TargetFrameworkMoniker (id, version, profile);
						if (rescanKnownFrameworks || !Runtime.SystemAssemblyService.IsKnownFramework (moniker)) {
							var fx = ReadTargetFramework (moniker, profileDir);
							if (fx != null)
								yield return (fx);
						}
					}
				}
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:27,代码来源:TargetRuntime.cs

示例8: FromFrameworkDirectory

		public static TargetFramework FromFrameworkDirectory (TargetFrameworkMoniker moniker, FilePath dir)
		{
			var fxList = dir.Combine ("RedistList", "FrameworkList.xml");
			if (!System.IO.File.Exists (fxList))
				return null;
			
			var fx = new TargetFramework (moniker);
			
			using (var reader = System.Xml.XmlReader.Create (fxList)) {
				if (!reader.ReadToDescendant ("FileList"))
					throw new Exception ("Missing FileList element");
				
				//not sure what this is for
				//if (reader.MoveToAttribute ("Redist") && reader.ReadAttributeValue ())
				//	redist = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("Name") && reader.ReadAttributeValue ())
					fx.name = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("RuntimeVersion") && reader.ReadAttributeValue ()) {
					string runtimeVersion = reader.ReadContentAsString ();
					switch (runtimeVersion) {
					case "2.0":
						fx.clrVersion = ClrVersion.Net_2_0;
						break;
					case "4.0":
						fx.clrVersion = ClrVersion.Net_4_0;
						break;
					default:
						throw new Exception ("Unknown RuntimeVersion '" + runtimeVersion + "'");
					}
				}
				
				if (reader.MoveToAttribute ("ToolsVersion") && reader.ReadAttributeValue ()) {
					string runtimeVersion = reader.ReadContentAsString ();
					switch (runtimeVersion) {
					case "2.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V2_0;
						break;
					case "3.5":
						fx.toolsVersion = TargetFrameworkToolsVersion.V3_5;
						break;
					case "4.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V4_0;
						break;
					default:
						throw new Exception ("Unknown ToolsVersion '" + runtimeVersion + "'");
					}
				}
				
				if (reader.MoveToAttribute ("IncludeFramework") && reader.ReadAttributeValue ()) {
					string include = reader.ReadContentAsString ();
					if (!string.IsNullOrEmpty (include)) {
						fx.IncludedFrameworks.Add (new TargetFrameworkMoniker (fx.Id.Identifier, include));
					}
				}
				
				var assemblies = new List<AssemblyInfo> ();
				if (reader.ReadToFollowing ("File")) {
					do {
						var ainfo = new AssemblyInfo ();
						assemblies.Add (ainfo);
						if (reader.MoveToAttribute ("AssemblyName") && reader.ReadAttributeValue ())
							ainfo.Name = reader.ReadContentAsString ();
						if (string.IsNullOrEmpty (ainfo.Name))
							throw new Exception ("Missing AssemblyName attribute");
						if (reader.MoveToAttribute ("Version") && reader.ReadAttributeValue ())
							ainfo.Version = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("PublicKeyToken") && reader.ReadAttributeValue ())
							ainfo.PublicKeyToken = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("Culture") && reader.ReadAttributeValue ())
							ainfo.Culture = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("ProcessorArchitecture") && reader.ReadAttributeValue ())
							ainfo.ProcessorArchitecture = (ProcessorArchitecture)
								Enum.Parse (typeof (ProcessorArchitecture), reader.ReadContentAsString (), true);
						if (reader.MoveToAttribute ("InGac") && reader.ReadAttributeValue ())
							ainfo.InGac = reader.ReadContentAsBoolean ();
					} while (reader.ReadToFollowing ("File"));
				} else {
					var files = System.IO.Directory.GetFiles (dir, "*.dll");
					foreach (var f in files) {
						try {
							var an = SystemAssemblyService.GetAssemblyNameObj (dir.Combine (f));
							var ainfo = new AssemblyInfo ();
							ainfo.Update (an);
							assemblies.Add (ainfo);
						} catch (Exception ex) {
							LoggingService.LogError ("Error reading name for assembly '{0}' in framework '{1}':\n{2}",
								f, fx.Id, ex.ToString ());
						}
					}
				}
				fx.Assemblies = assemblies.ToArray ();
			}
			
			return fx;
		}
开发者ID:louissalin,项目名称:monodevelop,代码行数:97,代码来源:TargetFramework.cs

示例9: FromFrameworkDirectory

		public static TargetFramework FromFrameworkDirectory (TargetFrameworkMoniker moniker, FilePath dir)
		{
			var fxList = dir.Combine ("RedistList", "FrameworkList.xml");
			if (!File.Exists (fxList))
				return null;
			
			var fx = new TargetFramework (moniker);
			
			using (var reader = System.Xml.XmlReader.Create (fxList)) {
				if (!reader.ReadToDescendant ("FileList"))
					throw new Exception ("Missing FileList element");
				
				//not sure what this is for
				//if (reader.MoveToAttribute ("Redist") && reader.ReadAttributeValue ())
				//	redist = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("Name") && reader.ReadAttributeValue ())
					fx.name = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("RuntimeVersion") && reader.ReadAttributeValue ()) {
					string runtimeVersion = reader.ReadContentAsString ();
					switch (runtimeVersion) {
					case "2.0":
						fx.clrVersion = ClrVersion.Net_2_0;
						break;
					case "4.0":
						fx.clrVersion = ClrVersion.Net_4_0;
						break;
					case "4.5":
					case "4.5.1":
						fx.clrVersion = ClrVersion.Net_4_5;
						break;
					default:
						LoggingService.LogInfo ("Framework {0} has unknown RuntimeVersion {1}", moniker, runtimeVersion);
						return null;
					}
				}
				
				if (reader.MoveToAttribute ("ToolsVersion") && reader.ReadAttributeValue ()) {
					string toolsVersion = reader.ReadContentAsString ();
					switch (toolsVersion) {
					case "2.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V2_0;
						break;
					case "3.5":
						fx.toolsVersion = TargetFrameworkToolsVersion.V3_5;
						break;
					case "4.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V4_0;
						break;
					case "4.5":
						fx.toolsVersion = TargetFrameworkToolsVersion.V4_5;
						break;
					default:
						LoggingService.LogInfo ("Framework {0} has unknown ToolsVersion {1}", moniker, toolsVersion);
						return null;
					}
				}
				
				if (reader.MoveToAttribute ("IncludeFramework") && reader.ReadAttributeValue ()) {
					string include = reader.ReadContentAsString ();
					if (!string.IsNullOrEmpty (include)) {
						fx.IncludedFrameworks.Add (new TargetFrameworkMoniker (fx.Id.Identifier, include));
					}
				}
				
				//this is a Mono-specific extension
				if (reader.MoveToAttribute ("TargetFrameworkDirectory") && reader.ReadAttributeValue ()) {
					string targetDir = reader.ReadContentAsString ();
					if (!string.IsNullOrEmpty (targetDir)) {
						targetDir = targetDir.Replace ('\\', System.IO.Path.DirectorySeparatorChar);
						dir = fxList.ParentDirectory.Combine (targetDir).FullPath;
					}
				}
				
				var assemblies = new List<AssemblyInfo> ();
				if (reader.ReadToFollowing ("File")) {
					do {
						var ainfo = new AssemblyInfo ();
						assemblies.Add (ainfo);
						if (reader.MoveToAttribute ("AssemblyName") && reader.ReadAttributeValue ())
							ainfo.Name = reader.ReadContentAsString ();
						if (string.IsNullOrEmpty (ainfo.Name))
							throw new Exception ("Missing AssemblyName attribute");
						if (reader.MoveToAttribute ("Version") && reader.ReadAttributeValue ())
							ainfo.Version = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("PublicKeyToken") && reader.ReadAttributeValue ())
							ainfo.PublicKeyToken = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("Culture") && reader.ReadAttributeValue ())
							ainfo.Culture = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("ProcessorArchitecture") && reader.ReadAttributeValue ())
							ainfo.ProcessorArchitecture = (ProcessorArchitecture)
								Enum.Parse (typeof (ProcessorArchitecture), reader.ReadContentAsString (), true);
						if (reader.MoveToAttribute ("InGac") && reader.ReadAttributeValue ())
							ainfo.InGac = reader.ReadContentAsBoolean ();
					} while (reader.ReadToFollowing ("File"));
				} else {

					// HACK: we were using EnumerateFiles but it's broken in some Mono releases
					// https://bugzilla.xamarin.com/show_bug.cgi?id=2975
//.........这里部分代码省略.........
开发者ID:venomak,项目名称:monodevelop,代码行数:101,代码来源:TargetFramework.cs

示例10: GetTargetFramework

		public TargetFramework GetTargetFramework (TargetFrameworkMoniker id)
		{
			EnsureRuntimesInitialized ();
			return GetTargetFramework (id, frameworks);
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:5,代码来源:SystemAssemblyService.cs

示例11: IsCompatibleWithFramework

		public bool IsCompatibleWithFramework (TargetFrameworkMoniker fxId)
		{
			// FIXME: this is a hack which should really be done using the xml definitions for each .NETPortable profile
			if (fxId.Identifier == ".NETPortable" && fxId.Version == "4.0")
				return HackyCheckForPLPCompatibility (fxId);

			return fxId.Identifier == this.id.Identifier
				&& new Version (fxId.Version).CompareTo (new Version (this.id.Version)) <= 0;
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:9,代码来源:TargetFramework.cs

示例12: HackyCheckForPLPCompatibility

		bool HackyCheckForPLPCompatibility (TargetFrameworkMoniker fxId)
		{
			int profile, this_profile;

			if (fxId.Profile == null || fxId.Profile.Length < 8 || !int.TryParse (fxId.Profile.Substring (7), out profile))
				return false;

			switch (this.id.Identifier) {
			case TargetFrameworkMoniker.ID_NET_FRAMEWORK:
				if (new Version (fxId.Version).CompareTo (new Version (this.id.Version)) > 0)
					return false;

				return profile >= 1 && profile <= 3; // Profile4 does not support .NETFramework
			case TargetFrameworkMoniker.ID_MONOTOUCH:
			case TargetFrameworkMoniker.ID_MONODROID:
				return profile >= 1 && profile <= 3;
			case TargetFrameworkMoniker.ID_PORTABLE:
				if (this.id.Profile == null || this.id.Profile.Length < 8 || !int.TryParse (this.id.Profile.Substring (7), out this_profile))
					return false;

				switch (this_profile) {
				case 1: return true;
				case 2: return profile == 2;
				case 3: return profile == 3;
				case 4: return profile == 4;
				default: return false;
				}
			default:
				return false;
			}
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:31,代码来源:TargetFramework.cs

示例13: ReferenceAssemblyFramework

		public ReferenceAssemblyFramework (TargetFrameworkMoniker targetFramework)
		{
			Include = targetFramework.ToString ();
		}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:4,代码来源:ReferenceAssemblyFramework.cs

示例14: GetTargetFramework

		public TargetFramework GetTargetFramework (TargetFrameworkMoniker id)
		{
			foreach (TargetFramework fx in frameworks)
				if (fx.Id == id)
					return fx;
			LoggingService.LogWarning ("Unregistered TargetFramework '{0}' is being requested from SystemAssemblyService", id);
			TargetFramework f = new TargetFramework (id);
			frameworks.Add (f);
			return f;
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:10,代码来源:SystemAssemblyService.cs

示例15: CreateNuGetPackagingProject

		async Task CreateNuGetPackagingProject (ProgressMonitor monitor)
		{
			FilePath projectFileName = GetNewProjectFileName ("NuGetPackaging");
			packagingProject = Services.ProjectService.CreateProject ("NuGetPackaging") as PackagingProject;
			packagingProject.FileName = projectFileName;

			var createInfo = CreateProjectCreateInformation (projectFileName);
			packagingProject.InitializeFromTemplate (createInfo, CreateProjectOptions ());

			var moniker = new TargetFrameworkMoniker (TargetFrameworkMoniker.ID_NET_FRAMEWORK, "4.5", null);
			packagingProject.TargetFramework = Runtime.SystemAssemblyService.GetTargetFramework (moniker);

			MoveNuGetPackageMetadataToPackagingProject ();

			await Project.SaveAsync (monitor);

			Project.ParentFolder.AddItem (packagingProject);
			AddNuGetPackagingProjectReferences ();

			await SaveProject (monitor, packagingProject);
		}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:21,代码来源:AddPlatformImplementationViewModel.cs


注:本文中的TargetFrameworkMoniker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。