Make sure it builds with VS2019

This commit is contained in:
de4dot 2019-03-24 13:14:39 +01:00
parent 1c642f123b
commit 726887c285
7 changed files with 44 additions and 42 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<!--
- appveyor.yml (artifacts)
- build.ps1
- build.cmd
- dnSpy/dnSpy/app.config (supportedRuntime, .NET Framework only)
NOTE: Update the ABOVE files when TargetFrameworks is updated -->
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
@ -19,7 +19,7 @@
<AppDesignerFolderContentsVisibleOnlyInShowAllFiles>false</AppDesignerFolderContentsVisibleOnlyInShowAllFiles>
<!-- Make sure we don't have to publish each extension to get all their refs -->
<CopyLocalLockFileAssemblies Condition=" '$(IsDotNetCore)' == 'true' ">true</CopyLocalLockFileAssemblies>
<!-- If this gets updated, also update appveyor.yml and build.ps1 -->
<!-- If this gets updated, also update appveyor.yml and build.cmd -->
<DnSpyRuntimeIdentifiers>win-x86;win-x64</DnSpyRuntimeIdentifiers>
<!-- Update app.config whenever this value changes -->
@ -36,12 +36,12 @@
<IcedVersion>1.2.0</IcedVersion>
<MSBuildNuGetVersion>15.9.20</MSBuildNuGetVersion>
<MSDiagRuntimeVersion>1.0.5</MSDiagRuntimeVersion>
<MSVSCompositionNetFxAttributesVersion>15.8.117</MSVSCompositionNetFxAttributesVersion>
<MSVSCompositionVersion>15.8.117</MSVSCompositionVersion>
<MSVSIntellisenseVersion>15.5.27130</MSVSIntellisenseVersion>
<MSVSTextVersion>15.5.27130</MSVSTextVersion>
<OokiiDialogsVersion>1.0.0</OokiiDialogsVersion>
<RoslynVersion>2.10.0</RoslynVersion>
<SCCompositionVersion>4.6.0-preview3.19128.7</SCCompositionVersion>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)Build\ConvertToNetstandardReferences\ConvertToNetstandardReferences.tasks" Condition=" '$(IsDotNetCore)' == 'true' " />

View File

@ -37,6 +37,10 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup Condition=" '$(IsDotNetFramework)' == 'true' AND '$(MSBuildRuntimeType)' != 'Core' ">
<Reference Include="PresentationFramework.Aero" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="$(MSVSTextVersion)" />
</ItemGroup>

View File

@ -1,5 +1,5 @@
version: x.x.{build}
image: Visual Studio 2017
image: Visual Studio 2019 Preview
configuration: Release
install:
- cmd: git submodule update --init --recursive

View File

@ -1,2 +1,21 @@
@echo off
powershell -NoLogo -NoProfile -File build.ps1 -ExecutionPolicy Bypass
REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/0xd4d/dnSpy/issues/1053
REM dotnet build -c Release -f net472
REM dotnet publish -c Release -f netcoreapp3.0 -r win-x86 --self-contained
REM dotnet publish -c Release -f netcoreapp3.0 -r win-x64 --self-contained
REM .NET Framework x86 and x64
msbuild -v:m -t:Restore || goto :error
msbuild -v:m -t:Build -p:Configuration=Release -p:TargetFramework=net472 || goto :error
REM .NET Core x86
msbuild -v:m -t:Restore -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x86 -p:SelfContained=True || goto :error
msbuild -v:m -t:Publish -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x86 -p:SelfContained=True || goto :error
REM .NET Core x64
msbuild -v:m -t:Restore -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x64 -p:SelfContained=True || goto :error
msbuild -v:m -t:Publish -p:Configuration=Release -p:TargetFramework=netcoreapp3.0 -p:RuntimeIdentifier=win-x64 -p:SelfContained=True || goto :error
goto :EOF
:error
exit /b %errorlevel%

View File

@ -1,36 +0,0 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
#
# Until .NET Core 3.0 is released, use the latest daily build
#
$dotnetsdkZipFile = "dotnetsdk.zip"
Write-Host "Downloading latest build of .NET Core"
Invoke-WebRequest "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x86.zip" -OutFile "$dotnetsdkZipFile"
$tempPath = [System.IO.Path]::GetTempPath()
$dotnetPath = "$tempPath" + [System.IO.Path]::GetRandomFileName()
Write-Host "Extracting the zip file"
Expand-Archive "$dotnetsdkZipFile" -DestinationPath "$dotnetPath" -Force
del "$dotnetsdkZipFile"
$dotnetExe = "$dotnetPath\dotnet.exe"
#
# Show the version in the log
#
Invoke-Expression '&"$dotnetExe" --version'
if ($LastExitCode -ne 0) { exit 1 }
#
# Build it
#
Write-Host "Building (.NET Framework)"
Invoke-Expression '&"$dotnetExe" build -c Release -f net472'
if ($LastExitCode -ne 0) { exit 1 }
Write-Host "Building (.NET Core x86)"
Invoke-Expression '&"$dotnetExe" publish -c Release -f netcoreapp3.0 -r win-x86 --self-contained'
if ($LastExitCode -ne 0) { exit 1 }
Write-Host "Building (.NET Core x64)"
Invoke-Expression '&"$dotnetExe" publish -c Release -f netcoreapp3.0 -r win-x64 --self-contained'
if ($LastExitCode -ne 0) { exit 1 }

View File

@ -36,7 +36,17 @@
<ItemGroup>
<PackageReference Include="Ookii.Dialogs" Version="$(OokiiDialogsVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Composition.NetFxAttributes" Version="$(MSVSCompositionNetFxAttributesVersion)" />
<!--TODO: This is a workaround for a bug where we get the wrong version of System.Security.Permissions.
Microsoft.VisualStudio.Composition.NetFxAttributes and Microsoft.VisualStudio.Composition reference
System.ComponentModel.Composition 4.5.0 which references System.Security.Permissions 4.5.0 which has
assembly version 4.0.1.0. The runtime has asm version 4.0.2.0. This library is copied to the output dir
overwriting the 4.0.2.0 file because CopyLocalLockFileAssemblies=true in DnSpyCommon.props (to prevent
us having to publish all extensions).
Will probably be fixed after Microsoft.VisualStudio.Composition.NetFxAttributes and Microsoft.VisualStudio.Composition
reference a newer System.ComponentModel.Composition nuget in which case this hack can be removed.
-->
<PackageReference Include="System.ComponentModel.Composition" Version="$(SCCompositionVersion)" Condition=" '$(CopyLocalLockFileAssemblies)' == 'true' " />
<PackageReference Include="Microsoft.VisualStudio.Composition.NetFxAttributes" Version="$(MSVSCompositionVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.Intellisense" Version="$(MSVSIntellisenseVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="$(MSVSTextVersion)" />
</ItemGroup>

View File

@ -84,6 +84,11 @@
</COMReference>
</ItemGroup>
<ItemGroup Condition=" '$(IsDotNetFramework)' == 'true' AND '$(MSBuildRuntimeType)' != 'Core' ">
<Reference Include="PresentationFramework.Aero" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Iced" Version="$(IcedVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(MSVSCompositionVersion)" />