Search code examples
c#.net-3.5.net-client-profile

Cannot deploy Visual C# application


I have been able to run my C# .net 3.5 app just fine on my development machine, but I can't seem to get it run anywhere else. The client machines have the 4.0 .net client profile installed and after looking up what is left out of the client profile, I doubt that installing the full 4.0 framework would make a difference.

I am using classes from these libraries:

using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using System.Diagnostics;
using Microsoft.Win32;

The only thing out of the ordinary that I am doing is defining a CustomApplicationContext instead of the normal App Context that you would use for a Forms application. My app runs primarily as a NotifyIcon in the System Tray, so I just set up a class who's main interface is that System Tray Icon. Nothing too bizarre.

For testing purposes I have my first line of code display a MessageBox and even this won't run. Whenever I start it on the deploy machine is just pops up a box saying "App failed to start" and shuts down.

Does anyone have any idea why it would be doing this? I can't seem to get it to run a bit of code.


Solution

  • Perhaps what you need is to add .Net4.0 to your supported runtime list. Add the following lines to your app.config

    <configuration>
       <startup useLegacyV2RuntimeActivationPolicy="true">
          <supportedRuntime version="v4.0"/>
       </startup>
    </configuration>