How is assembly allowed during development?

I have an extensibility library (or its beginning) with UITypeEditor. Now I would like to decorate the EditorAttribute property. I do not want to reference the extensibility library, since it does not need to be deployed, so I use this:

[Editor("MyProject.Extensibility.MyUIEditor, MyProject.Extensibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", typeof (UITypeEditor))] MySpecialType SpecialType { get; set; } 

This does not work. The type editor is intended for use in enumerations, and when I use it, a standard enumeration down is displayed. However, if you copy the type editor into the project and use the direct type link, everything works fine. I tried to test my string using Activator.CreateInstance and I succeeded. MyProject.Extensibility.dll will be copied to almost every place (all project folders / debug folders). Is there any special place to host extensibility DLLs, so .net can allow assembly?

Thanks!

+4
source share
1 answer

Just enter Regedit.exe and create the key in the same way as:

  HKLM \ SOFTWARE \ Microsoft \ .NETFramework \ v2.0.50727 \ AssemblyFoldersEx \ StackOverflow

It doesn't really matter what the key name is; all the folder names listed in AssemblyFoldersEx are looked up for the build time of the Visual Studio assembly.

The folder should be added to Regedit using the entry (default) that has the path to the folder as the value. (See, for example, words for sibling).

Interestingly, all folders present in the AssemblyFoldersEx registry key will also automatically appear when you click "Add New Link" in the project’s context menu on the .NET tab.

Another approach would be to add the desired assembly to the global access cache (c: \ Windows \ Assembly)

I just did the following test: On the resource assembly, I put the following code:

 public class MyEditor : UITypeEditor { public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { MessageBox.Show("Works"); return null; } } 

In the consumer assembly (building Windows executables), I created a component that comes from Button just like this:

 public class MyButton : Button { [Editor("AssemblyReferenceCL.MyEditor, AssemblyReferenceCL", typeof(UITypeEditor))] public String MyProp { get; set; } } 

There is no link between the two assemblies. Everything worked fine.

+4
source

All Articles