InstallStatus.Checker
1.0.1
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Framework 4.8
This package targets .NET Framework 4.8. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package InstallStatus.Checker --version 1.0.1
NuGet\Install-Package InstallStatus.Checker -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InstallStatus.Checker" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InstallStatus.Checker" Version="1.0.1" />
<PackageReference Include="InstallStatus.Checker" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InstallStatus.Checker --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: InstallStatus.Checker, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package InstallStatus.Checker@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=InstallStatus.Checker&version=1.0.1
#tool nuget:?package=InstallStatus.Checker&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
微软商店程序安装检查器
一个用于在 Windows 上检查和启动已安装应用程序的 .NET 库,支持 MSIX 和 MSI 两种包格式。
功能特性
- 使用 MSIX 包系列名称检查应用程序是否已安装
- 使用 MSI 注册表信息检查应用程序是否已安装
- 获取详细安装信息(版本、安装位置等)
- 启动已安装的应用程序
- 以 JSON 格式返回结果,便于集成
安装方式
通过 NuGet 包管理器安装:
Install-Package InstallChecker
或者通过 .NET CLI 安装:
dotnet add package InstallChecker
使用方法
基本用法
using InstallStatus.Checker;
// 创建检查信息
var checkInfo = new InstallCheckInfo
{
TargetPackageFamilyName = "YourPackageFamilyName", // 用于MSIX应用
TargetAppId = "YourAppId" // 用于MSI应用
};
// 检查安装状态
string jsonResult = InstallChecker.CheckInstallStatusAsJson(checkInfo);
// 解析结果
var result = System.Text.Json.JsonSerializer.Deserialize<InstallCheckJsonResult>(jsonResult);
// 使用结果
if (result.MSIXIsInstalled)
{
Console.WriteLine($"MSIX应用版本: {result.MSIXAppVersion}");
Console.WriteLine($"MSIX安装位置: {result.MSIXInstallLocation}");
}
if (result.MSIIsInstalled)
{
Console.WriteLine($"MSI应用版本: {result.MSIAppVersion}");
Console.WriteLine($"MSI安装位置: {result.MSIInstallLocation}");
Console.WriteLine($"MSI可执行文件路径: {result.MSIExecutablePath}");
}
API 参考
InstallCheckInfo
包含要检查应用程序信息的类,核心属性说明:
- TargetPackageFamilyName:要检查的 MSIX 应用程序的包系列名称。
- TargetAppId:要检查的 MSI 应用程序的标识符(通常是注册表键名)。
InstallCheckJsonResult
包含安装检查结果的类,分为 MSIX 相关属性和 MSI 相关属性:
MSIX 属性
- MSIXIsInstalled:MSIX 应用程序是否已安装(布尔类型)。
- MSIXCheckLogs:MSIX 安装检查过程的日志(字符串类型)。
- MSIXAppVersion:已安装 MSIX 应用程序的版本(字符串类型)。
- MSIXErrorMsg:MSIX 检查失败时的错误消息(字符串类型,检查成功时为空)。
- MSIXInstallLocation:MSIX 应用程序的安装位置(字符串类型)。
MSI 属性
- MSIIsInstalled:MSI 应用程序是否已安装(布尔类型)。
- MSICheckLogs:MSI 安装检查过程的日志(字符串类型)。
- MSIAppVersion:已安装 MSI 应用程序的版本(字符串类型)。
- MSIErrorMsg:MSI 检查失败时的错误消息(字符串类型,检查成功时为空)。
- MSIInstallLocation:MSI 应用程序的安装位置(字符串类型)。
- MSIExecutablePath:MSI 应用程序的可执行文件路径(字符串类型)。
补充说明
- 所有属性均为公共可读可写属性(
public修饰),适配 .NET Standard 2.0 及以上版本。 - 日志属性(XXXCheckLogs)会记录检查过程中的关键步骤(如注册表读取、包信息查询),便于调试排查问题。
- 错误消息属性(XXXErrorMsg)仅在检查失败时返回具体错误信息(如“找不到指定的注册表项”“MSIX 包未注册”),检查成功时为空字符串。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows10.0.19041 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- No dependencies.
-
net8.0-windows10.0.19041
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.