當前位置: 首頁>>代碼示例>>C#>>正文


C# ProjectReference.GetReferencedFileNames方法代碼示例

本文整理匯總了C#中MonoDevelop.Projects.ProjectReference.GetReferencedFileNames方法的典型用法代碼示例。如果您正苦於以下問題:C# ProjectReference.GetReferencedFileNames方法的具體用法?C# ProjectReference.GetReferencedFileNames怎麽用?C# ProjectReference.GetReferencedFileNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoDevelop.Projects.ProjectReference的用法示例。


在下文中一共展示了ProjectReference.GetReferencedFileNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProjectRefToString

		string ProjectRefToString (ProjectReference pr, MakefileVar refVar)
		{
			string [] tmp = pr.GetReferencedFileNames (ConfigurationSelector.Default);
			if (tmp == null || tmp.Length == 0)
				//Reference not found, ignoring
				return null;

			return AsmRefToString (tmp [0], refVar, true);
		}
開發者ID:raufbutt,項目名稱:monodevelop-old,代碼行數:9,代碼來源:MakefileData.cs

示例2: GacRefToString

		string GacRefToString (ProjectReference pr, Dictionary<string, bool> hasAcSubstPackages, MakefileVar refVar)
		{
			//Gac ref can be a full name OR a path!
			//FIXME: Use GetReferencedFileName and GetPackageFromPath ?
			string fullname = pr.Reference;
			SystemPackage pkg = pr.Package;
			if (pkg == null) {
				//reference could be a path
				pkg = assemblyContext.GetPackageFromPath (Path.GetFullPath (pr.Reference));
				if (pkg != null) {
					//Path
					try {
						fullname = AssemblyName.GetAssemblyName (pr.Reference).FullName;
						//If this throws : Invalid assembly!
						//let it fall through and be emitted as a asm ref
					} catch (FileNotFoundException) {
						pkg = null;
					} catch (BadImageFormatException) {
						pkg = null;
					}
				}
			}

			if (pkg == null)
				return AsmRefToString (pr.GetReferencedFileNames (ConfigurationSelector.Default) [0], refVar, false);

			// Reference is from a package

			if (pkg.IsCorePackage)
				//pkg:mono, Eg. System, System.Data etc
				return fullname.Split (new char [] {','}, 2) [0];

			//Ref is from a non-core package
			string varname = null;
			if (UseAutotools)
				//Check whether ref'ed in configure.in
				varname = ConfiguredPackages.GetVarNameFromName (pkg.Name);
			
			if (varname == null) {
				//Package not referenced in configure.in
				//Or not a autotools based project,
				//so emit -pkg:

				if (!hasAcSubstPackages.ContainsKey (pkg.Name)) {
					if (UseAutotools) {
						//Warn only if UseAutotools
						string msg = GettextCatalog.GetString (
							"A reference to the pkg-config package '{0}' is being emitted to the Makefile, " +
							"because at least one assembly from the package is used in the project '{1}'. However, " +
							"this dependency is not specified in the configure.in file, so you might need to " +
							"add it to ensure that the project builds successfully on other systems.", pkg.Name, pr.OwnerProject.Name);
						LoggingService.LogWarning (msg);
						monitor.ReportWarning (msg);
					}

					hasAcSubstPackages [pkg.Name] = false;
				}
			} else {
				// If the package as AC_SUBST(FOO_LIBS) defined, then
				// emit FOO_LIBS, else emit -pkg:foo
				if (ConfiguredPackages.HasAcSubst (varname + "_LIBS")) {
					hasAcSubstPackages [varname] = true;
				} else {
					hasAcSubstPackages [pkg.Name] = false;
				}
			}

			return null;
		}
開發者ID:raufbutt,項目名稱:monodevelop-old,代碼行數:69,代碼來源:MakefileData.cs

示例3: GenerateReferenceStub

		static string GenerateReferenceStub (IProgressMonitor monitor, ConfigurationSelector configurationSelector, DotNetProjectConfiguration configuration, ProjectReference reference)
		{
			StringBuilder result = new StringBuilder ();
			foreach (string fileName in reference.GetReferencedFileNames (configurationSelector)) {
				string name = Path.GetFileNameWithoutExtension (Path.GetFileName (fileName));
				string outputName = Path.Combine (configuration.OutputDirectory, name + ".jar");
				if (!System.IO.File.Exists (outputName)) {
					monitor.Log.WriteLine (String.Format (GettextCatalog.GetString ("Generating {0} reference stub ..."), name));
					monitor.Log.WriteLine ("ikvmstub \"" + fileName + "\"");
					ProcessWrapper p = Runtime.ProcessService.StartProcess ("ikvmstub", "\"" + fileName + "\"", configuration.OutputDirectory, monitor.Log, monitor.Log, null);
					p.WaitForExit ();
					if (p.ExitCode != 0) {
						monitor.ReportError ("Stub generation failed.", null);
						if (File.Exists (outputName)) {
							try {
								File.Delete (outputName);
							} catch {
								// Ignore
							}
						}
					}
				}
				AppendClasspath (result, outputName);
			}
			return result.ToString ();
		}
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:26,代碼來源:IKVMCompilerManager.cs

示例4: GetNUnitVersion

		public static NUnitVersion? GetNUnitVersion (ProjectReference p)
		{
			if (p.Reference.IndexOf ("GuiUnit", StringComparison.OrdinalIgnoreCase) != -1 || p.Reference.StartsWith ("nunitlite", StringComparison.OrdinalIgnoreCase))
				return NUnitVersion.NUnit2;
			if (p.Reference.IndexOf ("nunit.framework", StringComparison.OrdinalIgnoreCase) != -1) {
				var selector = p.Project?.DefaultConfiguration.Selector;
				if (selector == null)
					return NUnitVersion.Unknown;

				var f = p.GetReferencedFileNames (selector).FirstOrDefault ();
				if (f != null && File.Exists (f)) {
					try {
						var aname = new AssemblyName (SystemAssemblyService.GetAssemblyName (f));
						if (aname.Version.Major == 2)
							return NUnitVersion.NUnit2;
						else
							return NUnitVersion.NUnit3;
					} catch (Exception ex) {
						LoggingService.LogError ("Could not get assembly version", ex);
					}
				}
			}
			return null;
		}
開發者ID:sushihangover,項目名稱:monodevelop,代碼行數:24,代碼來源:NUnitProjectTestSuite.cs

示例5: IsFromPackage

		//HACK: we don't have the info to do this properly, really the package management addin should handle this
		static bool IsFromPackage (ProjectReference r)
		{
			if (r.ReferenceType != ReferenceType.Assembly) {
				return false;
			}
			var packagesDir = r.Project.ParentSolution.BaseDirectory.Combine ("packages");
			return r.GetReferencedFileNames(null).Any (f => ((FilePath)f).IsChildPathOf (packagesDir));
		}
開發者ID:kdubau,項目名稱:monodevelop,代碼行數:9,代碼來源:PortableRuntimeOptionsPanel.cs


注:本文中的MonoDevelop.Projects.ProjectReference.GetReferencedFileNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。