Last active
August 29, 2015 14:06
-
-
Save jimmymain/d5d68ec7141a7c5f4fb0 to your computer and use it in GitHub Desktop.
references
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = "itextsharp"; | |
var dir = @"D:\Projects\Online\Service\Enhancements\Release\"; | |
var recurse = true; | |
var ns = new XmlNamespaceManager(new NameTable()); | |
ns.AddNamespace("x", "http://schemas.microsoft.com/developer/msbuild/2003"); | |
foreach (var file in Directory.EnumerateFiles(dir, "*.csproj", recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)) | |
{ | |
var document = XDocument.Load(file); | |
foreach (var element in document.XPathSelectElements("/x:Project/x:ItemGroup/x:Reference[starts-with(@Include,'" + name + "')]", ns)) | |
{ | |
var assemblyName = new AssemblyName(element.Attribute("Include").Value); | |
if (assemblyName.Name == name) | |
string.Format("{0}: {1}", file.Replace(dir, ".."), element.Attribute("Include").Value).Dump(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = "autofac"; | |
var dir = @"D:\Projects\Online\Service\Enhancements\Release\"; | |
var ns = new XmlNamespaceManager(new NameTable()); | |
ns.AddNamespace("x", "http://schemas.microsoft.com/developer/msbuild/2003"); | |
foreach (var file in Directory.EnumerateFiles(dir, "packages.config", SearchOption.AllDirectories)) { | |
if (File.ReadAllText(file).ToLowerInvariant().Contains(name.ToLowerInvariant())) { | |
file.Dump(); | |
File.ReadAllLines(file).Where(_ => _.ToLowerInvariant().Contains(name.ToLowerInvariant())).ToArray().Dump(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment