Reputation: 297
I'm thinking of making a simple self-contained .NET application with WPF that can run on any modern Windows system without requiring the end-user to download and install .NET Framework manually.
As far as I know user just need to click on .exe and wait some time until required libraries are installed.
But applications that were compiled for 3.5 use old L&F on most recent Windows.
Is there any way to make applications look like this:
and not like this (if user already has .NET Framework 4+):
Upvotes: 1
Views: 568
Reputation: 297
Finally I came up with simple solution. My assumption was wrong and it appears .NET Framework actually uses L&F of currently running version, not the targeting one.
App.config
(Project -> Add -> New Item... -> App configuration (.config))Paste following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<!-- Use 4.0 -->
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<!-- Use 2.0 - 3.5 -->
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
.NET Framework will scan <supportedRuntime>
until it finds available. List of supported runtimes can be found here.
Upvotes: 2