From 68bef577d235fa195ecb5444260edf2e8e87ea03 Mon Sep 17 00:00:00 2001 From: Mikhail Gorobets Date: Wed, 6 Dec 2023 09:20:32 +0600 Subject: [PATCH] Appveyor: Try to fix .NET restore --- BuildTools/Scripts/appveyor/install-dotnet.py | 34 +++++++++++++++++++ appveyor.yml | 6 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 BuildTools/Scripts/appveyor/install-dotnet.py diff --git a/BuildTools/Scripts/appveyor/install-dotnet.py b/BuildTools/Scripts/appveyor/install-dotnet.py new file mode 100644 index 000000000..dd75dc892 --- /dev/null +++ b/BuildTools/Scripts/appveyor/install-dotnet.py @@ -0,0 +1,34 @@ +import requests +import subprocess +import sys + +DOTNET_INSTALL_SCRIPT_URL = "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" + +DOTNET_INSTALL_SCRIPT_PATH = "dotnet-install.ps1" + +DOTNET_INSTALL_SCRIPT_ARGS = [ + "-Channel", "6.0.1xx", + "-Quality", "preview" +] + +def execute(command): + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + while True: + nextline = process.stdout.readline() + if not nextline and process.poll() is not None: + break + print(line.decode(), end='') + + +def main(): + response = requests.get(DOTNET_INSTALL_SCRIPT_URL) + with open(DOTNET_INSTALL_SCRIPT_PATH, 'wb') as script_file: + script_file.write(response.content) + + command = ["powershell.exe", "-ExecutionPolicy", "Bypass", "-File", DOTNET_INSTALL_SCRIPT_PATH] + DOTNET_INSTALL_SCRIPT_ARGS + execute(command) + + +if __name__ == "__main__": + main() diff --git a/appveyor.yml b/appveyor.yml index 35dafaa4b..3f0b8e8ed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,6 +32,10 @@ install: before_build: - cd c:\projects\DiligentSamples\BuildTools\FormatValidation + - cd c:\projects\DiligentSamples\BuildTools\Scripts\appveyor + - python -m pip install requests + - python install-dotnet.py + - cd c:\projects - validate_format_win.bat - cd c:\projects - echo cmake_minimum_required(VERSION 3.6) > CMakeLists.txt @@ -42,7 +46,7 @@ before_build: - echo add_subdirectory(DiligentSamples) >> CMakeLists.txt - echo %PLATFORM% - cmake -S . -B ./build -G "Visual Studio 16 2019" -A %PLATFORM% - - nuget restore c:\projects\build\DiligentSamples_Test.sln + - dotnet restore c:\projects\build\DiligentSamples_Test.sln build: project: c:\projects\build\DiligentSamples_Test.sln