Click here to Skip to main content
15,917,862 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
SuggestionRe: Writing unicode characters to an ASCII INI File (yes, you can!) Pin
ZurdoDev25-Oct-16 3:37
professionalZurdoDev25-Oct-16 3:37 
GeneralRe: Writing unicode characters to an ASCII INI File (yes, you can!) Pin
Gerry Schmitz25-Oct-16 4:50
mveGerry Schmitz25-Oct-16 4:50 
QuestionHOW TO SIGN XML FILE IN .NET COMPACT EDITION Pin
AlexB4717-Oct-16 19:29
AlexB4717-Oct-16 19:29 
Question"The feature you are trying to use ..." Error Pin
jszabo16-Oct-16 12:21
jszabo16-Oct-16 12:21 
AnswerRe: "The feature you are trying to use ..." Error Pin
Dave Kreskowiak16-Oct-16 13:33
mveDave Kreskowiak16-Oct-16 13:33 
GeneralRe: "The feature you are trying to use ..." Error Pin
jszabo17-Oct-16 12:24
jszabo17-Oct-16 12:24 
GeneralRe: "The feature you are trying to use ..." Error Pin
Dave Kreskowiak17-Oct-16 13:10
mveDave Kreskowiak17-Oct-16 13:10 
Question.net freelancer Pin
Member 1278822911-Oct-16 11:06
Member 1278822911-Oct-16 11:06 
AnswerRe: .net freelancer Pin
Dave Kreskowiak11-Oct-16 11:22
mveDave Kreskowiak11-Oct-16 11:22 
AnswerRe: .net freelancer Pin
Eddy Vluggen12-Oct-16 7:05
professionalEddy Vluggen12-Oct-16 7:05 
QuestionNested Components - Winforms Pin
Midi_Mick10-Oct-16 6:47
professionalMidi_Mick10-Oct-16 6:47 
AnswerRe: Nested Components - Winforms Pin
Midi_Mick11-Oct-16 0:24
professionalMidi_Mick11-Oct-16 0:24 
QuestionLife of IDisposable object members Pin
Midi_Mick2-Oct-16 7:25
professionalMidi_Mick2-Oct-16 7:25 
AnswerRe: Life of IDisposable object members Pin
Nathan Minier3-Oct-16 1:28
professionalNathan Minier3-Oct-16 1:28 
GeneralRe: Life of IDisposable object members Pin
Midi_Mick3-Oct-16 1:41
professionalMidi_Mick3-Oct-16 1:41 
GeneralRe: Life of IDisposable object members Pin
Nathan Minier3-Oct-16 1:46
professionalNathan Minier3-Oct-16 1:46 
QuestionControl Designers Pin
Midi_Mick27-Sep-16 4:02
professionalMidi_Mick27-Sep-16 4:02 
AnswerRe: Control Designers Pin
Gerry Schmitz28-Sep-16 13:26
mveGerry Schmitz28-Sep-16 13:26 
Questioninteroperation / Loading and unloading WPF assembly from arbitrary path Pin
achimschoen22-Sep-16 5:44
professionalachimschoen22-Sep-16 5:44 
I've put this question in the .NET folder since I guess this question is more related to the .NET framework than to C# or C++/CLI.

I'm currently struggling to find a way to load and unload a WPF assembly from an arbitrary path (not a sub directory of the base path) from a C# console application.

I was exploring codeproject for a couple of days (as I have done with some other forums), but I can't actually find a way how to get the console application loading the WPF assembly and instantiating an object from the assembly.

Starting point is the following example as C# console application:


C#
using WPFLibrary;

namespace Caller
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SampleWindow wnd = new SampleWindow();
            wnd.ShowDialog();
        }
     }
 }


and the following code as WPF assembly:

C#
namespace WPFLibrary
{   
    public partial class SampleWindow : Window
    {       
        public SampleWindow()
        {
            InitializeComponent();
        }
   }
}



I found various similar questions and suggestions to use:

- Reflection via: Assembly.Load();
- Using Activator.CreateInstance();
- Using a different AppDomain with CreateInstanceAndUnwrap
- Using AssemblyResolve for the AppDomain etc.
- etc

But I could never get my simple example above working if the WPFLibrary is not in a sub directory of the base path of the Caller console application. Since I'm new in this field I may just have missed a simple thing or this scenario may be completely impossible.... Any help would be appreciated.

Background of this question:



In case you are not interested to understand my motivation for this question just skip the remaining of this post. We are developing an c++ dll application for a commercial CAD system. The interface for this system is c/c++ only so there no way to change the complete code to a C# application. This application includes a simple scripting language which also allows to define and execute a graphical user interface. Currently this is encoded in a win32 / MFC way, but since it includes a self build layout manager it is obviously a good idea to think about other alternatives. A perfect match seems to be use use WPF, but that requires to use .NET and to allow XAML definitions a C# library connected by a C++/CLI dll seems to be a good setup.

Some major requirements are:

- The WPF dll must be able to be load from the installation of the application.
- It is required to stop and restart the application (so also the WPF assembly needs to be removed and reloaded).
AnswerRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
NotPolitcallyCorrect22-Sep-16 6:29
NotPolitcallyCorrect22-Sep-16 6:29 
GeneralRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
achimschoen22-Sep-16 6:44
professionalachimschoen22-Sep-16 6:44 
GeneralRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
NotPolitcallyCorrect22-Sep-16 7:02
NotPolitcallyCorrect22-Sep-16 7:02 
GeneralRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
achimschoen22-Sep-16 22:09
professionalachimschoen22-Sep-16 22:09 
AnswerRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
#realJSOP22-Sep-16 6:41
professional#realJSOP22-Sep-16 6:41 
AnswerRe: interoperation / Loading and unloading WPF assembly from arbitrary path Pin
Gerry Schmitz22-Sep-16 7:12
mveGerry Schmitz22-Sep-16 7:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.