开发者

How can I inform the user of an XCOPY WPF 4 app that he needs to install .NET 4?

I've made a small tool application with Visual Studio 2010 which to distribute it, I zip these files from the Release folder:

  • Data
    • MainData.mdf
    • MainData_log.ldf
  • DataBackup.exe
  • DataBackup.exe.config
  • FluidKit.dll

then unzip them on the target machine (no installation).

When I run it on a Windows 7 machine with .NET 4 installed, it runs fine.

When I run it on a Vista machine with .NET 3.5 installed, it gives me this default error message:

In order to run this appication, you need to install the开发者_Go百科 following version of .NET: v.4.0.21006 To learn how to install this version, contact the distributor of this application.

When I run it on an XP machine with .NET 3.0 installed, it gives me an error that doesn't that the application cannot start but doesn't mention installing .NET.

Is there anyway that I can intercept these messages to e.g. give a nice-looking, custom message with install instructions and a link to the .NET 4 download?


I think that the only solution is to make a small non-.NET application that checks if the .NET Framework is installed, and if so, launches your .NET application. For the framework detection part, see for example here: http://www.codeproject.com/KB/dotnet/DetectDotNet.aspx


Check out the Application.DispatcherUnhandledException Event... maybe you could globally catch the exception and inform your user in there about having to install .NET 4.0. Probably this can help you determine what .NET platform versions are installed, and maybe even avoid using the .NET 4 features if you see that the client machine does not have it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜