Skip to content

Commit

Permalink
Update to .NET 5 (#10346)
Browse files Browse the repository at this point in the history
* Update to .NET 5

.NET 5 brings many performance (especially regex) improvements
https://devblogs.microsoft.com/dotnet/announcing-net-5-0/

Can look at bringing the packages upto date and using a single file executable in a future PR if the maintainers are interested

* Dotnet restore before building

* Restore on Windows only

* Out of ideas

* Update framework for windows specific apps

* Don't upgrade Microsoft.Extensions.Configuration

* drop mono from the dotnet linux build instructions

* Fix logic to get app runtime

* readme: add windows .net prereq link

* Update README.md

* azure-pipeline: bump minorversion to 17

Co-authored-by: garfield69 <garfieldsixtynine@gmail.com>
Co-authored-by: Diego Heras <ngosang@hotmail.es>
Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com>
  • Loading branch information
4 people committed Dec 8, 2020
1 parent 6e8a616 commit 65ca4d7
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 45 deletions.
27 changes: 14 additions & 13 deletions README.md
Expand Up @@ -20,7 +20,7 @@ A third-party Golang SDK for Jackett is available from [webtor-io/go-jackett](ht

#### Supported Systems
* Windows 7SP1 or greater
* Linux [supported operating systems here](https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-supported-os.md#linux)
* Linux [supported operating systems here](https://github.com/dotnet/core/blob/master/release-notes/5.0/5.0-supported-os.md#linux)
* macOS 10.13 or greater

<details> <summary> <b> Supported Public Trackers </b> </summary>
Expand Down Expand Up @@ -587,12 +587,13 @@ We recommend you install Jackett as a Windows service using the supplied install

To get started with using the installer for Jackett, follow the steps below:

1. Download the latest version of the Windows installer, "Jackett.Installer.Windows.exe" from the [releases](https://github.com/Jackett/Jackett/releases/latest) page.
2. When prompted if you would like this app to make changes to your computer, select "yes".
3. If you would like to install Jackett as a Windows Service, make sure the "Install as Windows Service" checkbox is filled.
4. Once the installation has finished, check the "Launch Jackett" box to get started.
5. Navigate your web browser to http://127.0.0.1:9117
6. You're now ready to begin adding your trackers and using Jackett.
1. Check if you need any .NET prerequisites installed, see https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50#dependencies
2. Download the latest version of the Windows installer, "Jackett.Installer.Windows.exe" from the [releases](https://github.com/Jackett/Jackett/releases/latest) page.
3. When prompted if you would like this app to make changes to your computer, select "yes".
4. If you would like to install Jackett as a Windows Service, make sure the "Install as Windows Service" checkbox is filled.
5. Once the installation has finished, check the "Launch Jackett" box to get started.
6. Navigate your web browser to http://127.0.0.1:9117
7. You're now ready to begin adding your trackers and using Jackett.

When installed as a service the tray icon acts as a way to open/start/stop Jackett. If you opted to not install it as a service then Jackett will run its web server from the tray tool.

Expand Down Expand Up @@ -756,7 +757,7 @@ To use it, please just request a free API key on [OMDb](http://www.omdbapi.com/a
## Building from source

### Windows
* Install the .NET Core [SDK](https://www.microsoft.com/net/download/windows)
* Install the .NET 5 [SDK](https://www.microsoft.com/net/download/windows)
* Clone Jackett
* Open PowerShell and from the `src` directory, run `dotnet restore`
* Open the Jackett solution in Visual Studio 2019 (version 16.4 or above)
Expand All @@ -776,21 +777,21 @@ git clone https://github.com/Jackett/Jackett.git
cd Jackett/src

# dotnet core version
dotnet publish Jackett.Server -f netcoreapp3.1 --self-contained -r osx-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/netcoreapp3.1/osx-x64/jackett # run jackett
dotnet publish Jackett.Server -f net5.0 --self-contained -r osx-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net5.0/osx-x64/jackett # run jackett
```

### Linux


```bash
sudo apt install mono-complete nuget msbuild dotnet-sdk-3.1 # install build tools (Debian/ubuntu)
sudo apt install nuget msbuild dotnet-sdk-5.0 # install build tools (Debian/ubuntu)
git clone https://github.com/Jackett/Jackett.git
cd Jackett/src

# dotnet core version
dotnet publish Jackett.Server -f netcoreapp3.1 --self-contained -r linux-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/netcoreapp3.1/linux-x64/jackett # run jackett
dotnet publish Jackett.Server -f net5.0 --self-contained -r linux-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net5.0/linux-x64/jackett # run jackett
```

## Screenshots
Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Expand Up @@ -2,12 +2,12 @@
name: $(majorVersion).$(minorVersion).$(patchVersion)
variables:
majorVersion: 0
minorVersion: 16
minorVersion: 17
patchVersion: $[counter(variables['minorVersion'], 1)] # this will reset when we bump minor
jackettVersion: $(majorVersion).$(minorVersion).$(patchVersion)
buildConfiguration: Release
netCoreFramework: netcoreapp3.1
netCoreSdkVersion: 3.1.x
netCoreFramework: net5.0
netCoreSdkVersion: 5.0.x
# system.debug: true

trigger:
Expand Down Expand Up @@ -110,7 +110,7 @@ stages:
projects: 'src/Jackett.Tray/Jackett.Tray.csproj'
publishWebProjects: false
zipAfterPublish: false
arguments: '--configuration $(buildConfiguration) --runtime $(runtime) --framework $(framework) --output $(Build.BinariesDirectory) /p:AssemblyVersion=$(jackettVersion) /p:FileVersion=$(jackettVersion) /p:InformationalVersion=$(jackettVersion) /p:Version=$(jackettVersion)'
arguments: '--configuration $(buildConfiguration) --runtime $(runtime) --framework $(framework)-windows --output $(Build.BinariesDirectory) /p:AssemblyVersion=$(jackettVersion) /p:FileVersion=$(jackettVersion) /p:InformationalVersion=$(jackettVersion) /p:Version=$(jackettVersion)'

- task: DotNetCoreCLI@2
displayName: Build Jackett Service (Windows only)
Expand All @@ -120,7 +120,7 @@ stages:
projects: 'src/Jackett.Service/Jackett.Service.csproj'
publishWebProjects: false
zipAfterPublish: false
arguments: '--configuration $(buildConfiguration) --runtime $(runtime) --framework $(framework) --output $(Build.BinariesDirectory) /p:AssemblyVersion=$(jackettVersion) /p:FileVersion=$(jackettVersion) /p:InformationalVersion=$(jackettVersion) /p:Version=$(jackettVersion)'
arguments: '--configuration $(buildConfiguration) --runtime $(runtime) --framework $(framework)-windows --output $(Build.BinariesDirectory) /p:AssemblyVersion=$(jackettVersion) /p:FileVersion=$(jackettVersion) /p:InformationalVersion=$(jackettVersion) /p:Version=$(jackettVersion)'

- task: CopyFiles@2
displayName: Copy Jackett Server
Expand Down
6 changes: 3 additions & 3 deletions src/Jackett.Common/Jackett.Common.csproj
Expand Up @@ -22,10 +22,10 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MimeMapping" Version="1.0.1.30" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.7.4" />
<PackageReference Include="NLog" Version="4.7.5" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0" />
<PackageReference Include="YamlDotNet" Version="8.1.2" />
</ItemGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/Jackett.Common/Utils/DotNetCoreUtil.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Runtime.Versioning;

namespace Jackett.Common.Utils
{
Expand All @@ -13,7 +14,7 @@ public static bool IsRunningOnDotNetCore

try
{
runningOnDotNetCore = RuntimeInformation.FrameworkDescription.IndexOf("core", StringComparison.OrdinalIgnoreCase) >= 0;
runningOnDotNetCore = Assembly.GetEntryAssembly()?.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName.IndexOf("Core", StringComparison.OrdinalIgnoreCase) >= 0;
}
catch
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jackett.IntegrationTests/Jackett.IntegrationTests.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="Selenium.Chrome.WebDriver" Version="85.0.0" />
Expand Down
23 changes: 12 additions & 11 deletions src/Jackett.Server/Jackett.Server.csproj
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;net461</TargetFrameworks>
<ApplicationIcon>jackett.ico</ApplicationIcon>
<OutputType>Exe</OutputType>
<NoWarn></NoWarn>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp3.1|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0|AnyCPU'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp3.1|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net5.0|AnyCPU'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>
Expand All @@ -31,11 +31,12 @@
</Otherwise>
</Choose>

<!-- Conditionally obtain references for the .NET Core App 3.1 target -->
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<!-- Conditionally obtain references for the .NET 5.0 target -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="5.0.0" />
</ItemGroup>

<!-- Conditionally obtain references for the .NET461 target -->
Expand All @@ -47,6 +48,7 @@
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

Expand All @@ -55,11 +57,10 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="AutoMapper" Version="8.1.1" />
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
<PackageReference Include="NLog" Version="4.7.4" />
<PackageReference Include="NLog" Version="4.7.5" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Service/Jackett.Service.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<AssemblyName>JackettService</AssemblyName>
<ApplicationIcon>jackett.ico</ApplicationIcon>
Expand Down
10 changes: 5 additions & 5 deletions src/Jackett.Test/Jackett.Test.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;net461</TargetFrameworks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
Expand All @@ -25,14 +25,14 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="3.1.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.11.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Jackett.Tray/Jackett.Tray.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>JackettTray</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Updater/Jackett.Updater.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net461;net5.0</TargetFrameworks>
<ApplicationIcon>jackett.ico</ApplicationIcon>
<AssemblyName>JackettUpdater</AssemblyName>
<OutputType>Exe</OutputType>
Expand Down
1 change: 1 addition & 0 deletions src/Jackett.sln
Expand Up @@ -5,6 +5,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE7B0C8A-6144-47CD-821E-B09BA1B7BADE}"
ProjectSection(SolutionItems) = preProject
..\.editorconfig = ..\.editorconfig
..\azure-pipelines.yml = ..\azure-pipelines.yml
..\Installer.iss = ..\Installer.iss
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
Expand Down

0 comments on commit 65ca4d7

Please sign in to comment.