本文整理汇总了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);
}
示例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;
}
示例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 ();
}
示例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;
}
示例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));
}