本文整理汇总了C#中ICSharpCode.ILSpy.LoadedAssembly.LookupReferencedAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# LoadedAssembly.LookupReferencedAssembly方法的具体用法?C# LoadedAssembly.LookupReferencedAssembly怎么用?C# LoadedAssembly.LookupReferencedAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.ILSpy.LoadedAssembly
的用法示例。
在下文中一共展示了LoadedAssembly.LookupReferencedAssembly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteProjectFile
//.........这里部分代码省略.........
w.WriteElementString("TargetFrameworkVersion", "v1.1");
} else if (module.IsClr20) {
w.WriteElementString("TargetFrameworkVersion", "v2.0");
// TODO: Detect when .NET 3.0/3.5 is required
} else {
w.WriteElementString("TargetFrameworkVersion", "v4.0");
}
}
w.WriteElementString("WarningLevel", "4");
w.WriteEndElement(); // </PropertyGroup>
w.WriteStartElement("PropertyGroup"); // platform-specific
w.WriteAttributeString("Condition", " '$(Platform)' == '" + platformName + "' ");
w.WriteElementString("PlatformTarget", platformName);
w.WriteEndElement(); // </PropertyGroup> (platform-specific)
w.WriteStartElement("PropertyGroup"); // Debug
w.WriteAttributeString("Condition", " '$(Configuration)' == 'Debug' ");
w.WriteElementString("OutputPath", "bin\\Debug\\");
w.WriteElementString("DebugSymbols", "true");
w.WriteElementString("DebugType", "full");
w.WriteElementString("Optimize", "false");
if (options.DontReferenceStdLib) {
w.WriteStartElement("NoStdLib");
w.WriteString("true");
w.WriteEndElement();
}
w.WriteEndElement(); // </PropertyGroup> (Debug)
w.WriteStartElement("PropertyGroup"); // Release
w.WriteAttributeString("Condition", " '$(Configuration)' == 'Release' ");
w.WriteElementString("OutputPath", "bin\\Release\\");
w.WriteElementString("DebugSymbols", "true");
w.WriteElementString("DebugType", "pdbonly");
w.WriteElementString("Optimize", "true");
if (options.DontReferenceStdLib) {
w.WriteStartElement("NoStdLib");
w.WriteString("true");
w.WriteEndElement();
}
w.WriteEndElement(); // </PropertyGroup> (Release)
w.WriteStartElement("ItemGroup"); // References
foreach (var r in asmRefs) {
if (r.Name != "mscorlib") {
var asm = assembly.LookupReferencedAssembly(r, module);
if (asm != null && ExistsInProject(options, asm.FileName))
continue;
w.WriteStartElement("Reference");
w.WriteAttributeString("Include", IdentifierEscaper.Escape(r.Name));
var hintPath = GetHintPath(options, asm);
if (hintPath != null) {
w.WriteStartElement("HintPath");
w.WriteString(hintPath);
w.WriteEndElement();
}
w.WriteEndElement();
}
}
w.WriteEndElement(); // </ItemGroup> (References)
foreach (IGrouping<string, string> gr in (from f in files group f.Item2 by f.Item1 into g orderby g.Key select g)) {
w.WriteStartElement("ItemGroup");
foreach (string file in gr.OrderBy(f => f, StringComparer.OrdinalIgnoreCase)) {
w.WriteStartElement(gr.Key);
w.WriteAttributeString("Include", file);
w.WriteEndElement();
}
w.WriteEndElement();
}
w.WriteStartElement("ItemGroup"); // ProjectReference
foreach (var r in asmRefs) {
var asm = assembly.LookupReferencedAssembly(r, module);
if (asm == null)
continue;
var otherProj = FindOtherProject(options, asm.FileName);
if (otherProj != null) {
var relPath = GetRelativePath(options.SaveAsProjectDirectory, otherProj.ProjectFileName);
w.WriteStartElement("ProjectReference");
w.WriteAttributeString("Include", relPath);
w.WriteStartElement("Project");
w.WriteString(otherProj.ProjectGuid.ToString("B").ToUpperInvariant());
w.WriteEndElement();
w.WriteStartElement("Name");
w.WriteString(IdentifierEscaper.Escape(otherProj.AssemblySimpleName));
w.WriteEndElement();
w.WriteEndElement();
}
}
w.WriteEndElement(); // </ItemGroup> (ProjectReference)
w.WriteStartElement("Import");
w.WriteAttributeString("Project", "$(MSBuildToolsPath)\\Microsoft.CSharp.targets");
w.WriteEndElement();
w.WriteEndDocument();
}
}