I have a .NET application that is published using ClickOnce. For the most part, everything works well with this procedure, but every once in a while, a user will get an error that throws up the message shown below instead of opening the program:
Application cannot be started. Contact the application vendor.
I found the Troubleshooting Specific Errors in ClickOnce Deployments page on MSDN which states (in the Additional Errors section):
Error message
Application cannot be started. Contact the application publisher.
Cannot start the application. Contact the application vendor for assistance.
Description
These are generic error messages that occur when the application cannot be started, and no other specific reason can be found. Frequently this means that the application is somehow corrupted, or that the ClickOnce store is corrupted.
While it's not an exact match for the error message that is displayed for this problem, I think that it is close enough to fit into the above category of errors. Now the fix for this problem is to simply delete all of the ClickOnce user settings that are stored in...
C:\Users\USERNAME\AppData\Local\Apps\2.0
... so the problem is bearable, but my question is this:
What can I do to find out what is causing these generic errors so that I can stop them from occurring?
Contact the application vendor." What should I do? This error is typically due to a corrupted ClickOnce (a Microsoft installation technology) cache. Try deleting it and reinstalling AudioNote: To delete your ClickOnce cache (you may wish to make a backup copy first) delete the “\apps\2.0\” folder.
Unlike usual applications installed to the Program Files folder or a user-defined folder, ClickOnce applications are installed into the user profile, to a subfolder with an obfuscated name.
ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.
2 things:
If you click that "Details..." button you will get a log file which, usually, shows what the error is (it could be broken manifest file on server, etc).
If you say deleting local settings help, then it might be that user.config file gets corrupted. We had this issue in our app - and I was not able to find out WHY (my guess was that I was writing to Properties.Settings
too often but I'm not sure). Anyway, here is my workaround for it:
public static void Main()
{
if (ApplicationDeployment.IsNetworkDeployed == true)
{
try
{
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
}
catch (ConfigurationErrorsException ex)
{
string filename = ex.Filename;
_logger.Error(ex, "Cannot open config file");
if (File.Exists(filename) == true)
{
_logger.Error("Config file {0} content:\n{1}", filename, File.ReadAllText(filename));
File.Delete(filename);
_logger.Error("Config file deleted");
Properties.Settings.Default.Upgrade();
// Properties.Settings.Default.Reload();
// you could optionally restart the app instead
}
else
{
_logger.Error("Config file {0} does not exist", filename);
}
}
}
// code continues...
}
basically I try to read settings, if any error - log the broken file's content, delete it and continue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With