The uwp app is installed on the target machine. System.Diagnostics.FileVersionInfo.GetVersionInfo cannot read some exe information.
It can be read in the development environment or vs. It cannot be read on the installation client, and an error is reported and the path of the exe is returned.
I tried powershell reading, same thing. Development vs client can’t. I have a search network,
Some people say it is a permissions issue for the sandbox. Raise the permissions (I have started the client computer with administrator rights, to no avail)
code show as below
try
{
var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(filePath);
var fileInfo = new FileInfo(filePath);
newApp.AppVersion = $”{versionInfo.ProductMajorPart}.{versionInfo.ProductMinorPart}.{versionInfo.ProductBuildPart}.{versionInfo.ProductPrivatePart}”;
newApp.InstallDate = fileInfo.CreationTime;
}
catch (Exception ex)
{
LogService.WriteLog($”{newApp.AppName};{ex.message};[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取”);
}
return:
实时字幕;C:Windowssystem32LiveCaptions.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
Windows 内存诊断;C:Windowssystem32MdSched.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
系统配置;C:Windowssystem32msconfig.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
讲述人;C:Windowssystem32narrator.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
屏幕键盘;C:Windowssystem32osk.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
打印管理;C:Windowssystem32pmcsnap.dll;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
恢复驱动器;C:Windowssystem32RecoveryDrive.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
服务;C:Windowssystem32services.exe;[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
语音访问;C:Windowssystem32voiceaccess.exe[System.Diagnostics.FileVersionInfo.GetVersionInfo]无法读取
Most exes can be read but the ones listed above cannot be read.
user24969308 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.