We update our WPF app multiple times a week, this is a pain point as Customers are repeatedly asked to let the exe through their firewall.
To get around this, I will try taking most of the code (including xaml) out of the exe, so the exe never changes.
The below method seems to work, is there any reason why I should not do it this way? e.g. is it ok to have multiple Application objects?
Project: TestWpfSeperateCodeFromExe
namespace TestWpfSeperateCodeFromExe
{
public class App
{
// Entry point method
[STAThread]
public static void Main(string[] args)
{
AppView.Main(args);
}
}
}
Project: View
namespace View
{
public class AppView : Application
{
// Entry point method
[STAThread]
public static void Main(string[] args)
{
var app = new AppView();
app.Run();
}
public AppView()
{
new MainWindow().Show();
}
}
}
using another application-object will most likely break many things as you have no direct control over the process - you should avoid that and use simple function/method-calls instead, these work flawlessly and thats what DLLs are for. In fact, i actually think this wont be possible in the way you imagined it.
Using DLLs like everbody does has loads of advantages, you can move 99% of your code into the DLL and make the primary entry-point (the EXE-file) absolutely static, theres no need to fiddle around with the application-object.