[{"data":1,"prerenderedAt":203},["ShallowReactive",2],{"article-net-4-new-gac-locations-gacutil":3},{"article":4,"tags":59,"previous":87,"next":153},{"id":5,"title":6,"author":7,"body":8,"createdAt":46,"description":47,"extension":48,"img":49,"meta":50,"navigation":51,"path":52,"seo":53,"stem":54,"tags":55,"updatedAt":46,"__hash__":58},"articles\u002Farticles\u002Fnet-4-new-gac-locations-gacutil.md",".NET 4 New GAC Locations\u002FGacUtil","[object Object]",{"type":9,"value":10,"toc":42},"minimark",[11,15,18,21,24,27,30,33,36,39],[12,13,14],"p",{}," This is what I know, let me know if you know otherwise.  There are now 2 distinct GAC locations that you have to manage as of the .NET 4 Framework release.",[12,16,17],{},"The GAC was split into two, one for each CLR (2.0, 3.5 AND 4.0).  The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. To avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.  The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.",[12,19,20],{},"In previous .NET versions, when I installed a .NET assembly into the GAC (using gacutil.exe or even drag and drop to the c:\\windows\\assembly directory), I could find it in the ‘C:\\Windows\\assembly’ path.",[12,22,23],{},"With .NET 4.0, GAC is now located in the 'C:\\Windows\\Microsoft.NET\\assembly’ path.",[12,25,26],{},"In order to install a dll to the .NET 4 GAC it is necessary to use the gacutil found C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\GacUtil.exe  In addition, you can no longer use the drag n' drop (in reality the drag n' drop really executed the gacutil via a windows explorer extension).",[12,28,29],{},"After you use the gacutil.exe -i {path to dll} you can view that it is indeed in the gac via gacutil -l (which will list all dlls in the gac).  I used this command and piped the results to a text file via > out.txt which made it easier to find the recently added component.",[12,31,32],{},"I was not able to see my gac object in the directory for .net 4 (i.e. c:\\windows\\microsoft.net\\assembly path).  I am not sure why just yet.  Ideas?",[12,34,35],{},"At this point, the object is in the local gac however if you are using vs.net 2010 it will still not show up in the list of references. To get the component to show up in the VS.NET list of references can add a registry entry to HKLM\\SOFTWARE\\WOW6432Node\\Microsoft.NETFramework\\v4.0.30319\\AssemblyFoldersEx  At this point, the component is in the local GAC and is in the list of references to be used by vs.net.",[12,37,38],{},"Note, I did find that if I just added the path to the registry without adding it to the gac it was available to vs.net.  So, because the component is listed via vs.net add references it does not necessarily mean it is in the gac.",[12,40,41],{},"What still confuses me is that I am still unable to view my recently added component in the .NET 4 directories above.  Ideas?",{"title":43,"searchDepth":44,"depth":44,"links":45},"",2,[],"2015-04-20T08:07:14.0800000-04:00","There are now 2 distinct GAC locations that you have to manage as of the .NET 4 Framework release...","md","\u002Farticles\u002Fimages\u002Fggb4dMDcZM.png",{},true,"\u002Farticles\u002Fnet-4-new-gac-locations-gacutil",{"title":6,"description":47},"articles\u002Fnet-4-new-gac-locations-gacutil",[56,57],"aspnet","enterpriselibrary","2K_K7LqZ6HZ_OhbA_zCui0-ixHdV9XtLRHPoIkAcdss",[60,74],{"id":61,"title":62,"body":63,"description":67,"extension":48,"img":68,"meta":69,"name":56,"navigation":51,"path":70,"seo":71,"stem":72,"__hash__":73},"tags\u002Ftags\u002Faspnet.md","Aspnet",{"type":9,"value":64,"toc":65},[],{"title":43,"searchDepth":44,"depth":44,"links":66},[],"ASP.NET is an open source web framework, created by Microsoft, for building modern web apps and services with .NET.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Faspnet",{"description":67},"tags\u002Faspnet","SlUGLdZWQy8mYOWC6OetgJkwVulWNURoVHeuESIDleI",{"id":75,"title":76,"body":77,"description":81,"extension":48,"img":68,"meta":82,"name":57,"navigation":51,"path":83,"seo":84,"stem":85,"__hash__":86},"tags\u002Ftags\u002Fenterpriselibrary.md","Enterpriselibrary",{"type":9,"value":78,"toc":79},[],{"title":43,"searchDepth":44,"depth":44,"links":80},[],"Enterprise Library (not to be confused by Entity Framework)",{},"\u002Ftags\u002Fenterpriselibrary",{"description":81},"tags\u002Fenterpriselibrary","8K38ejjAJwlBSzEmuwI8cDmMUOLiuGbh7qKzUcvirIo",{"id":88,"title":89,"author":7,"body":90,"createdAt":145,"description":146,"extension":48,"img":146,"meta":147,"navigation":51,"path":148,"seo":149,"stem":150,"tags":151,"updatedAt":145,"__hash__":152},"articles\u002Farticles\u002Fiterate-over-object-properties-and-property-attributes-w-reflection.md","Iterate Over Object Properties and Property Attributes w\u002FReflection",{"type":9,"value":91,"toc":143},[92,95,133,139],[12,93,94],{},"Define custom attribute class as follows as well as placing the attribute reference on the property “FirstName”.  In the following we are creating our own custom attribute by defining an attribute class which derives from Attribute which makes identifying attribute definitions in metadata easy.  The AttributeUsage attribute can be used to limit which asset the attribute can be placed such as class, struct, property etc.  In addition, in the example below I have disallowed multiple similar attributes from being used on the same property designated by AllowMultiple = false     ",[96,97,101,102,106,109,110,119,130],"pre",{"className":98},[99,100],"brush:","csharp","    ",[103,104,105],"span",{},"AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)",[107,108],"br",{},"\npublic class CustomItemAttribute : Attribute {",[96,111,116],{"className":112,"code":114,"language":115},[113],"language-text","    public string FieldName { get; set; }  \n\n    private bool _isMultiValue = false;  \n    public bool IsMultiValue {  \n        get { return _isMultiValue; }  \n        set {  \n            _isMultiValue = value;  \n        }  \n    }  \n\n    public CustomItemAttribute(string fieldName) {  \n        this.FieldName = fieldName;          \n    }  \n}  \n","text",[117,118,114],"code",{"__ignoreMap":43},[12,120,121,122,124,127,129],{},"public class Item{",[107,123],{},[103,125,126],{},"CustomItem(\"myfieldname\")",[107,128],{},"\npublic string FirstName { get; set;}",[12,131,132],{},"}",[12,134,135,136,138],{},"Now to iterate over the properties. Notice in the class Item above how we can exclude the 'Attribute' text in the name of the attribute applied to the FirstName property. Below we can use Type.GetProperties method to get the names of the properties for a specific type. The method GetProperties returns an array of PropertyInfo objects and the property names aer available through PropertyInfo.Name. If you want to get only a subset of the properties such as public static ones you can use BindingFlags parameters (Public\u002FNonPublic, Instance\u002FStatic). i.e. PropertyInfo",[103,137],{}," infos = typeof(Item).GetProperties(BindingFlags.Public|BindingFlags.Static);",[96,140,142],{"className":141},[99,100],"        private void IterateOverProperties() {  \n            CustomItemAttribute customItemAttribute;  \n            Type type = typeof(Item);  \n        \u002F\u002Ffor each property of object of Item  \n            foreach (PropertyInfo propInfo in type.GetProperties()) {  \n                \u002F\u002Ffor each custom attribute on the property loop  \n                foreach CustomItemAttribute attr in propInfo.GetCustomAttributes(typeof(CustomItemAttribute), false)) {  \n                    customItemAttribute = attr as CustomItemAttribute;  \n                    if (customItemAttribute != null) {  \n                        string propertyName = propInfo.Name;  \n                        string fieldName = customItemAttribute.FieldName;              \n            \u002F\u002FTODO: add your logic here  \n                    }   \n                }  \n            }  \n        }",{"title":43,"searchDepth":44,"depth":44,"links":144},[],"2015-04-20T08:07:14.1700000-04:00",null,{},"\u002Farticles\u002Fiterate-over-object-properties-and-property-attributes-w-reflection",{"title":89,"description":146},"articles\u002Fiterate-over-object-properties-and-property-attributes-w-reflection",[56],"ZthYNR0xRiDSvIjg9fVGjlPJjgpoE9X9J0htudQFbIM",{"id":154,"title":155,"author":7,"body":156,"createdAt":193,"description":194,"extension":48,"img":195,"meta":196,"navigation":51,"path":197,"seo":198,"stem":199,"tags":200,"updatedAt":193,"__hash__":202},"articles\u002Farticles\u002Fchange-silverlight-class-library-to-application.md","Change Silverlight Class Library to Application",{"type":9,"value":157,"toc":191},[158,161,169,179,182,185,188],[12,159,160],{},"Add New Item to the Silverlight Class project > Silverlight Application Class (This adds app.xaml, app.xaml.cs files)",[12,162,163,164,168],{},"Open the class library project file and change ",[165,166,167],"silverlight-application",{},"false","\nto true (Unload the class library project and edit the csproj file)",[12,170,171,172],{},"Add new element XapOutputs to project file below the element",[165,173,174,175],{}," i.e. add ",[176,177,178],"xap-outputs",{},"true",[12,180,181],{},"Now open Project Properties of the Silverlight Class library and change to the > Silverlight tab > Change the starter object",[12,183,184],{},"Change the following Project Property > Silverlight tab > Set the Xap file name",[12,186,187],{},"In the related web application add project property > Silverlight tab > Add your Silverlight application",[12,189,190],{},"You have not changed a Silverlight class library to an application project where the xap will be output and copied to the respective web site ClientBin directory.",{"title":43,"searchDepth":44,"depth":44,"links":192},[],"2015-04-20T08:07:13.8700000-04:00","Changing class library type to application.","\u002Farticles\u002Fimages\u002Fm8gdjJD1VK.png",{},"\u002Farticles\u002Fchange-silverlight-class-library-to-application",{"title":155,"description":194},"articles\u002Fchange-silverlight-class-library-to-application",[201],"silverlight","u_COjDxXgW8q1CXFUEeyO_rqVp2EzKopDX8j3mKRw2Y",1781574762455]