static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
bool owned;
Mutex mutex = new Mutex(true, Application.ProductName +
"manifest", out owned);
if (owned)
{
if (ThemeManifest.Create())//Create XP Theme
{
Process process =
System.Diagnostics.Process.Start(Application.ExecutablePath);
process.WaitForInputIdle();
Application.Exit();
}
else
{
Run();
}
mutex.ReleaseMutex();
}
else
{
Run();
}
}
private static void Run()
{
bool owned;
Mutex mutex = new Mutex(true, Application.ProductName +
"single", out owned);
if (owned)
{
Application.Run(new MainForm());
You cannot have a standalone Windows Forms application. The .NET Framework
must be installed to use WinForms. In fact, most scenarios when you would
want a single file (web distribution for example) are exactly when you need
to have code pre-installed in trusted system directories.
You can use RemoteSoft's Salamander products. This will bunding everything
up into a single exe, including all .Net framework components.
We've used this on machines where clients wouldn't allow us to install the
..Net framework, but we still wanted the advantages of building WinForms apps
in .Net.
How well does it duplicate the run-time semantics? It surely can't
implement security in the same way, because only GAC-installed DLLs can use
AllowPartiallyTrustedCallersAttribute to let applications downloaded from
the web run in a sandbox. Presumably it just appears to the OS as a native
app, resulting in warnings from the browser and then running with full trust
if the user chooses to continue?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.