问题
When I try to run .NET 3.5 applications on Windows 8.1 which has not .NET 3.5 Framework, Windows will show the "An app on your PC needs the following Windows feature. .NET Framework 3.5 (includes .NET 2.0 and .NET 3.0)" dialog automatically.
But I want to show this dialog programmatically. I think that the dialog is much more friendly than DISM command.
Any help would be appreciated.
回答1:
The dialogue you are searching for is provided by a tool called Fondue (Features on Demand User Experience Tool). To request .NET 3.5 you need to invoke it like this:
FONDUE.exe /enable-feature:NetFx3
Available features can be listed using DISM:
DISM.exe /Online /Get-Features
You can find additional details on Fondue invocation using FONDUE.exe /?
or on TechNet.
回答2:
- Search the registry for .NET 3.5 using Microsoft's suggested code.
- Create a Windows Form program and show a
MessageBox
if the PC does not have .NET 3.5. example code
This is predicated on the PC having a .NET Framework installed. You can't check if the .NET Framework is installed using C#.
回答3:
It's impossible. But here I have 2 solutions.
You can make a starter in C# or other programming laguage used to check the registry key of .NET Framework to determine which version has the user installed, or no .NET Framework installed.
Using InnoSetup. InnoSetup allows you to write some scripts to check dependency on the user's computer. You should package your application to a setup application. Therefore, your application is no longer a portable software.
来源:https://stackoverflow.com/questions/29551954/how-to-show-an-app-on-your-pc-needs-the-following-windows-feature-dialog-prog