Customize Error message for when ClickOnce application notices wrong version of .Net installed

StackOverflow https://stackoverflow.com/questions/14567021

  •  05-03-2022
  •  | 
  •  

Question

When you try and run a .Net 4 ClickOnce application on a machine running .Net 3.5, it pops up the following error:

Unable to install or run this application. This application requires your system
to be updated to Microsoft Common Language Runtime Version 4.0.30319.0.

Please contact your system administrator.

My question is, is there any way to customize the body of this error message, so that I could put in a custom phone number to call, instead of displaying the above?

Note: I can't just include the prerequesites for the user to install, because the user does not have sufficient rights to install it by themselves anyways, hence why I want to add a phone number to our tech support staff in the error message.

Was it helpful?

Solution

Let's think about this: the manifest file launches the deploy file launches the executable, I think the error message is coming from the deploy file as the executable cannot run without the proper framework. Thereby the answer to your question would be no in a traditional sense.

Of course, you can use an existing app or service to customize that kind of error message, but you'd be stuck deploying that system as well. What I don't get is my clickonce apps install the framework for you resolving the problem themselves, if yours don't for some reason, I'd recommend putting an executable of .NET 4 FW on a share and linking people from there.

Another hackish way you can do it, is if your setup is like mine, you have a web page that clickonce installs off, maybe you could check in that web page? You'd have to change from .htm to .aspx, but that's not a problem on an iis server.

OTHER TIPS

Is this an exception you can catch in code? If so, you can just create and throw an exception with your own message.

throw new Exception("your message here");

You can also check the value of Environment.Version on your initialization sequence to see what version of .NET is installed on the system, then display a message accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top