c# - Getting Assembly GUID programmatically that matches that in Visual studio solution file (*.sln) -
After text "itemprop =" text ">
I get an assembly GUID that is used in a visual studio solution file (* .sln), like below Wish:
Microsoft Visual Studio Solution File, Format Version 12.00 #Visual Studio 2010 Project ("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary3", ".. \ ClassLibrary3 \ ClassLibrary3 .csproj "" {5B402A1B-18B1-4D88-804A-BC0E58EF3730} "EndProject
I tried all under code, failed :
// Number 1: var Assembly = assembly. Loadfile (grandProject.AssemblyFilePath); Var id = assembly.GetType () GUID.ToString (); // Effort 2 var attribute = (GuidAttribute) assembly. GetCustomAttributes (typeof (GuidAttribute), true) [0]; Var id = attribute.Value;
Any ideas?
* GUID used in the assembly. The SLN file is in the * .csproj file
& lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; Project Tools version = "12.0" default target = "build" xmlns = "http://schemas.microsoft.com/developer/msbuild/2003" & gt; & Lt; PropertyGroup & gt; & Lt; ProjectGuid & gt; {5B402A1B-18B1-4D88-804A-BC0E58EF3730} & lt; / ProjectGuid & gt; & Lt; / PropertyGroup & gt; & Lt; / Project & gt;
Comments
Post a Comment