Skip to content

Commit

Permalink
fix tfm net461
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Dec 7, 2021
1 parent 9ed58d2 commit 68b087c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 33 deletions.
2 changes: 2 additions & 0 deletions Avalonia.Win32.JumpLists/Avalonia/Win32/JumpLists/JumpList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Avalonia.Win32.JumpLists
using System.Windows.Shell;
#endif

#if !NETFRAMEWORK
/// <summary>
/// The list of possible reasons why a JumpItem would be rejected from a JumpList when applied.
/// </summary>
Expand Down Expand Up @@ -112,6 +113,7 @@ public JumpItemsRemovedEventArgs(IList<JumpItem> removedItems)

public IList<JumpItem> RemovedItems { get; private set; }
}
#endif

/// <summary>
/// Manage the tasks and files that Shell associates with this application.
Expand Down
64 changes: 41 additions & 23 deletions Example/Example.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<DefineConstants>NET_WINDOWS;NET_WINDOWS_10;$(DefineConstants)</DefineConstants>
<Nullable>enable</Nullable>
<UseWindowsForms>false</UseWindowsForms>
<UseWPF>false</UseWPF>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Avalonia.Win32.JumpLists\Avalonia.Win32.JumpLists.csproj" Aliases="JumpLists" />
<PackageReference Include="System.Reactive" Version="5.0.0.1-exclude-winforms" />
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
<PackageReference Include="MessageBox.Avalonia" Version="1.0.6" />
</ItemGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0;net6.0-windows10.0.19041;net461</TargetFrameworks>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
<SignAssembly>false</SignAssembly>
</PropertyGroup>

<PropertyGroup Condition=" $(TargetFramework.Contains('.0')) ">
<UseWindowsForms>false</UseWindowsForms>
<UseWPF>false</UseWPF>
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Avalonia.Win32.JumpLists\Avalonia.Win32.JumpLists.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
<PackageReference Include="MessageBox.Avalonia" Version="1.0.6" />
</ItemGroup>

<ItemGroup Condition=" !$(TargetFramework.Contains('-windows')) ">
<PackageReference Include="System.Reactive" Version="5.0.0.0" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.Contains('-windows')) ">
<PackageReference Include="System.Reactive" Version="5.0.0.1-exclude-winforms" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net47' OR '$(TargetFramework)' == 'net471' OR '$(TargetFramework)' == 'net472' OR '$(TargetFramework)' == 'net48' ">
<Reference Include="PresentationFramework" />
</ItemGroup>
</Project>
15 changes: 6 additions & 9 deletions Example/JumpLists.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#if NET_WINDOWS
extern alias JumpLists;
using JumpLists::System.Windows.Shell;
using JumpLists::Avalonia.Win32.JumpLists;
#else
using System.Windows.Shell;
using Avalonia.Win32.JumpLists;
#endif
using System.Text;
using Avalonia;
using System.Text;
using MessageBox.Avalonia;
using Avalonia.Win32.JumpLists;
#if NETFRAMEWORK
using System.Windows.Shell;
using JumpList = Avalonia.Win32.JumpLists.JumpList;
#endif

namespace Example
{
Expand Down
4 changes: 3 additions & 1 deletion Example/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public string Greeting
@string.AppendLine(Environment.NewLine);
@string.AppendFormat("OSVersion: {0}", Environment.OSVersion.Version);
@string.AppendLine();
#if NET_WINDOWS_10
@string.AppendFormat("Runtime: {0}", Environment.Version);
@string.AppendLine();
#if WINDOWS10_0_17763_0_OR_GREATER
if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 10240)
{
#pragma warning disable CA1416 // 验证平台兼容性
Expand Down

0 comments on commit 68b087c

Please sign in to comment.