locked
Load dll dynamically RRS feed

  • Question

  • Hai all,

    My Problem is, i want to create instance for one xaml from assembly without adding reference.

    var folder = Package.Current.InstalledLocation;
                folder = await folder.GetFolderAsync("Notes");
                foreach (var file in await folder.GetFilesAsync())
                {
                    if (file.FileType == ".dll" && file.DisplayName == "Popup")
                    {
                        file.CopyAsync(Package.Current.InstalledLocation);
                        var assemblyName = new AssemblyName(file.DisplayName);
                        var assembly = Assembly.Load(assemblyName);
                        Type myType = assembly.GetType("Popup.TestPage");
                        object obj = Activator.CreateInstance(myType);
                        this.Content = obj as FrameworkElement;
                    }
                }

    i have wrote above code.. it will work if i add reference. It will not work without reference.

    Any suggestions.. Please help techies..


    • Edited by PrabuViji Wednesday, August 26, 2015 10:51 AM
    Wednesday, August 26, 2015 10:40 AM

Answers