如何确保WPF应用程序在用户计算机上完美运行?

发布于 2024-07-26 15:32:36 字数 454 浏览 0 评论 0 原文

最近我制作了 WPF 应用程序并希望将其发布给许多用户,但应用程序似乎在某些目标用户计算机上存在问题。 当用户启动它时它就会崩溃。 我使用 .NET Framework v.3.0 作为目标版本构建应用程序,并且用户计算机安装了 .NET Framework。 我只是想要一种方法来确保(例如安装系统)我的应用程序运行时没有错误。

真正奇怪的是,在我的测试电脑上(没有安装 Visual Studio,但只安装了 3.0 .NET Framework),它运行得很好。

除了 .NET 之外,应用程序没有任何其他引用。

以下是下载此应用程序的链接,因此如果您愿意,可以测试它: http://nippon.is74.ru/ForismaticTray.7z

Recently I made the WPF application and want to publish it for many users but application seems to have problems on some target user machines. It simply crashes when user is starting it. I build app with .NET Framework v.3.0 as target version and user machine has .NET Framework installed. I just want a way to ensure (for instance with installing system) my application will run with no errors.

What is really strange, on my testing PCs (with no Visual Studio installed but just with 3.0 .NET Framework) it runs perfectly.

Application haven't any addition references except .NET ones.

Here are a link to download this application so if you want you can test it:
http://nippon.is74.ru/ForismaticTray.7z

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

今天小雨转甜 2024-08-02 15:32:36

使用 NSIS 等安装程序并检查您的框架。 如果它不在目标计算机上,请安装它。这是我在 NSIS

Function IsDotNetInstalledAdv
  !insertmacro MUI_HEADER_TEXT "Checking for prerequisites." "Checking for .net framework 3.5 SP1.."

  ReadRegDWORD $0 HKLM "software\Microsoft\NET Framework Setup\NDP\v3.5" "SP"
  StrCmp $0 1 skip.DotNet  
  !insertmacro MUI_HEADER_TEXT "Installing .net framework." "Installing .net framework 3.5 SP1.."

  DetailPrint "Proceeding to install dotnet bootstrap installer...."
  sleep 1000
MessageBox MB_YESNO|MB_ICONQUESTION "This software requires DotNet framework ${MIN_FRA_MAJOR}.${MIN_FRA_MINOR}.${MIN_FRA_BUILD}.$\r$\n$\r$\nDo you wish to install it now?" IDNO skip.DotNet
  SetOutPath $TEMP
  File "${PACKAGE_DIR_BIN}\dotNetFx35setup.exe"
  GetDlgItem $0 $HWNDPARENT 1
  System::Call "kernel32::CreateMutexA(i 0, i 0, t 'DotNetInstall') i .r0 ?e"
  HideWindow
  ExecWait "$TEMP\dotNetFx35setup.exe /qbf /norestart" $1
  Delete "$TEMP\dotNetFx35setup.exe"
  ShowWindow $0 ${SW_SHOW}
  BringToFront

  IntCmp $1 0 skip.DotNet
  IntCmp $1 8192 skip.DotNet
  IntCmp $1 3010 0 DotNetInstallationFailed DotNetInstallationFailed
  SetRebootFlag true
  goto skip.DotNet

  DotNetInstallationFailed:
    HideWindow
    MessageBox MB_OK|MB_ICONSTOP "DotNet Framework 3.5 was not successfully installed on the machine"
    Quit

  skip.DotNet:
FunctionEnD

下载并打包 3.5 SP1 中所做的操作 Microsoft

有关 NSIS

更新:对于 3.0,请检查注册表中的 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3。 0 文件夹。

Use an installer like NSIS and check for your framework. If its not on the target machine, install it.Here's what I do in NSIS

Function IsDotNetInstalledAdv
  !insertmacro MUI_HEADER_TEXT "Checking for prerequisites." "Checking for .net framework 3.5 SP1.."

  ReadRegDWORD $0 HKLM "software\Microsoft\NET Framework Setup\NDP\v3.5" "SP"
  StrCmp $0 1 skip.DotNet  
  !insertmacro MUI_HEADER_TEXT "Installing .net framework." "Installing .net framework 3.5 SP1.."

  DetailPrint "Proceeding to install dotnet bootstrap installer...."
  sleep 1000
MessageBox MB_YESNO|MB_ICONQUESTION "This software requires DotNet framework ${MIN_FRA_MAJOR}.${MIN_FRA_MINOR}.${MIN_FRA_BUILD}.$\r$\n$\r$\nDo you wish to install it now?" IDNO skip.DotNet
  SetOutPath $TEMP
  File "${PACKAGE_DIR_BIN}\dotNetFx35setup.exe"
  GetDlgItem $0 $HWNDPARENT 1
  System::Call "kernel32::CreateMutexA(i 0, i 0, t 'DotNetInstall') i .r0 ?e"
  HideWindow
  ExecWait "$TEMP\dotNetFx35setup.exe /qbf /norestart" $1
  Delete "$TEMP\dotNetFx35setup.exe"
  ShowWindow $0 ${SW_SHOW}
  BringToFront

  IntCmp $1 0 skip.DotNet
  IntCmp $1 8192 skip.DotNet
  IntCmp $1 3010 0 DotNetInstallationFailed DotNetInstallationFailed
  SetRebootFlag true
  goto skip.DotNet

  DotNetInstallationFailed:
    HideWindow
    MessageBox MB_OK|MB_ICONSTOP "DotNet Framework 3.5 was not successfully installed on the machine"
    Quit

  skip.DotNet:
FunctionEnD

Download and package 3.5 SP1 from Micorsoft

More about NSIS

Update: For 3.0 check registry for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 folder.

猫瑾少女 2024-08-02 15:32:36

这可能是 .NET 服务包问题吗? 如果您使用 Visual Studio 2008 编写应用程序,即使您明确将其设置为目标 .NET 3.0,您的应用程序基本上也会以 .NET 3.0 SP1 为目标,因为它是由 .NET 3.5 安装的(由 Visual Studio 安装) 2008)。 您可以尝试将用户的计算机升级到 .NET 3.0 SP1(我相信可以在 Microsoft 网站上单独下载),看看是否可以解决问题。

Could this be a .NET service pack issue? If you are using Visual Studio 2008 to write your application, even if you explicitly set it to target .NET 3.0, your app will basically be targeting .NET 3.0 SP1, since that is installed by .NET 3.5 (which is installed by Visual Studio 2008). You might try upgrading the user's machine to .NET 3.0 SP1 (which is available as a separate download on Microsoft's site, I believe) and see if that fixes the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文