I'm experiencing the err above with my app as I attempt to deploy it, but only in certain scenarios:

1. In the VS IDE: no problem, my app runs fine
2. Double-clicking my .exe in Windows explorer: no problem, my app runs fine
3. Right-clicking my .exe in Windows explorer and selecting "Run As": I get the error above, and it won't run
4. Right-clicking my .exe in Windows explorer on a remote machine where the .exe has been deployed and selecting "Run As": I get the error above, and it won't run
5. Double-clicking a desktop link/shortcut to the .exe on a remote machine where the .exe has been deployed: very vague err msg, and my app won't run.

The info from the Windows Event Log (after failure with scenario 3) is:

```
Type: Error
Source: .NET Runtime
Message: Application: duckbilledPlatypus.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException
Stack:   at duckbilledPlatypus.duckbilledPlatypusMainForm..ctor()
   at duckbilledPlatypus.Program.Main()

```

I'm flailing about, searching and trying different things, grasping at straws. Here's one:

Is there something wrong with the layout of my App.config file (below)? 

Note: I just added "supportedRuntime version="v4.0.30319" but it made no difference; do I need to add "startup" to the "configSections" section?

```
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="log4net"     
type="log4net.Config.Log4NetConfigurationSectionHandler,     
log4net"/>
  </configSections>
  <log4net>
    <appender name="ConsoleAppender"     
type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date{ISO8601} [%thread]     
%-5level %-50.50logger | %message%newline"/>
      </layout>
    </appender>
    <appender name="DebugAppender"     
type="log4net.Appender.DebugAppender">
      <immediateFlush value="true"/>
      <layout type="log4net.Layout.SimpleLayout"/>
    </appender>
    <root>
      <level value="DEBUG"/>
      <appender-ref ref="ConsoleAppender"/>
    </root>
  </log4net>
  <startup>
    <supportedRuntime version="v4.0"    
sku=".NETFramework,Version=v4.0"/>
    <supportedRuntime version="v4.0.30319" />
  </startup>
</configuration>

```

Note: I have the following .NET versions installed: 1.0.3705; 1.1.4322; 2.0.50727; 3.0; 3.5; and 4.0.30319

So does the user on whose machine I've deployed my app...

If I change the startup to:

```
  <startup>
    <supportedRuntime version="v4.0.30319" 
sku=".NETFramework,Version=v4.0.30319" />
  </startup>

```

I get (even in the IDE), "*To run this application, you first must install one of the following versions of the .NET Framework: .NETFramework,Version=4.0.30319
Would you like to download and install .NETFramework,Version-v4.0.30319 now?*"

If I just use this, though:

```
  <startup>
    <supportedRuntime version="v4.0.30319" />
  </startup>

```

It runs in the IDE fine...but I still have all the problematic other scenarios (chiefly, that it won't run in the deployed location)...???

UPDATE
------

In answer to Charleh, the only thing in the main form's constructor is:

```
InitializeComponent();

foreach (string arg in Environment.GetCommandLineArgs()) {
    if (arg == "-DEBUG") {
        InDebugMode = true;
        break;
    }
}

tsch = new ToolStripControlHost(dateTimePickerDuckbilledPlatypus);
toolStripDuckbilledPlatypusMain.Items.Add(tsch);

```

UPDATED AGAIN
-------------

I just tried removing the following from App.config altogether:

```
  <startup>
    <supportedRuntime version="v4.0.30319" />
  </startup>

```

...but it makes no difference.

UPDATED YET AGAIN
-----------------

It seemed that once I copied over a file that it needed to access (a .txt file), it ran fine (it did so once). But now it's back to not even wanting to open again, and the event log data is:

```
Source: .NET Runtime
Message: Application: duckbilledPlatypus.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
Stack:   at duckbilledPlatypus.duckbilledPlatypusMainForm.InitializeComponent()
   at duckbilledPlatypus.duckbilledPlatypusMainForm..ctor() at duckbilledPlatypus.Program.Main()

```

Will this problem arise if more than one people are accessing either the .exe or the .txt?

UPDATED FOR THE FINAL TIME, I RECKON
------------------------------------

The upshot is, first I had failed to copy a couple of .dlls and a text file that the .exe needed. Once those were there, it ran fine. STILL, THOUGH, it seems quite bizarre to me that right-clicking the file gave the bogus err msg about a missing/wrong version of the .NET runtime AND that the err msg is so misleading. Why can't an err msg tell you which .DLL or file that was not found? That would make debugging so much simpler/faster.