Skip to content

Commit

Permalink
Fix build (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 authored Jun 16, 2024
1 parent 96b853f commit 65bb603
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
6.0.423
7.0.120
8.0.302
- name: Restore dependencies
run: dir "C:\Program Files\dotnet\\shared\Microsoft.WindowsDesktop.App\"
- name: Restore dependencies
run: dotnet restore WinFormsComInterop.Build.sln
- name: Build
Expand Down
22 changes: 13 additions & 9 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<Project>
<PropertyGroup>
<DotnetInstallLocation>C:\Program Files\dotnet</DotnetInstallLocation>
<DotnetInstallLocation Condition="$(NetCoreRoot) == ''">C:\Program Files\dotnet\</DotnetInstallLocation>
<DotnetInstallLocation Condition="$(NetCoreRoot) != ''">$(NetCoreRoot)</DotnetInstallLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net8.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\8.0.6\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net7.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\7.0.20\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net6.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\6.0.31\Accessibility.dll</AccessibilityLocation>
</PropertyGroup>
<ItemGroup>
<Reference Update="Accessibility" Condition="$(TargetFramework) == 'net8.0'">
<HintPath>$(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\8.0.6\Accessibility.dll</HintPath>
</Reference>
<Reference Update="Accessibility" Condition="$(TargetFramework) == 'net7.0'">
<HintPath>$(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\7.0.20\Accessibility.dll</HintPath>
</Reference>
<Reference Update="Accessibility" Condition="$(TargetFramework) == 'net6.0'">
<HintPath>$(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\6.0.27\Accessibility.dll</HintPath>
<Reference Update="Accessibility" Condition="($(TargetFramework) == 'net8.0') or ($(TargetFramework) == 'net7.0') or ($(TargetFramework) == 'net6.0')">
<HintPath>$(AccessibilityLocation)</HintPath>
</Reference>
</ItemGroup>
<Target Name="CustomClean" BeforeTargets="CoreBuild">
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net8.0') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net7.0') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net6.0') and (!Exists('$(AccessibilityLocation)'))" />
</Target>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.302",
"version": "8.0.200",
"allowPrerelease": true,
"rollForward": "major"
}
Expand Down

0 comments on commit 65bb603

Please sign in to comment.