Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: upgrade .net framework to 4.6.2 #863

Merged
merged 4 commits into from
Nov 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
framework:
@@ -30,7 +28,7 @@ jobs:
- name: Build
run: msbuild .\Box.V2
- name: Test
run: dotnet test .\Box.V2.Test -f net45
run: dotnet test .\Box.V2.Test -f net462

core:
name: Build and Test - Core
2 changes: 0 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
core:
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@ name: Lint Code Base
on:
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
build:
2 changes: 0 additions & 2 deletions .github/workflows/spell-check-lint.yml
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@ name: spell-check-lint
on:
pull_request_target:
types: [opened, synchronize, edited]
branches:
- main
jobs:
spellcheck-request-title:
runs-on: ubuntu-latest
2 changes: 1 addition & 1 deletion Box.V2.Samples.JWTAuth/Box.V2.Samples.JWTAuth.csproj
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Box.V2.Samples.JWTAuth</RootNamespace>
<AssemblyName>Box.V2.Samples.JWTAuth</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
2 changes: 1 addition & 1 deletion Box.V2.Samples.JWTAuth/app.config
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
2 changes: 1 addition & 1 deletion Box.V2.Samples.TransactionalAuth/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Box.V2.Samples.TransactionalAuth</RootNamespace>
<AssemblyName>Box.V2.Samples.TransactionalAuth</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
8 changes: 4 additions & 4 deletions Box.V2.Test.Integration/Box.V2.Test.Integration.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>

<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@@ -10,15 +10,15 @@
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp2.0'))">
<ProjectReference Include="..\Box.V2.Core\Box.V2.Core.csproj" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net45'))">
<ItemGroup Condition="$(TargetFramework.StartsWith('net462'))">
<ProjectReference Include="..\Box.V2\Box.V2.csproj" />
</ItemGroup>
<ItemGroup>
23 changes: 6 additions & 17 deletions Box.V2.Test/Box.V2.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,40 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net462</TargetFrameworks>

<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Moq" Version="4.18.2" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netcore')) or $(TargetFramework.StartsWith('net5.0')) or $(TargetFramework.StartsWith('net6.0'))">
<ProjectReference Include="..\Box.V2.Core\Box.V2.Core.csproj" />
<PackageReference Include="Moq">
<Version>4.7.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net45'))">
<ItemGroup Condition="$(TargetFramework.StartsWith('net462'))">
<ProjectReference Include="..\Box.V2\Box.V2.csproj" />
<PackageReference Include="Moq">
<Version>4.2.1312.1622</Version>
</PackageReference>
<Reference Include="System" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
</ItemGroup>
<ItemGroup>
12 changes: 6 additions & 6 deletions Box.V2/Box.V2.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Box.V2</RootNamespace>
<AssemblyName>Box.V2</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -21,23 +21,23 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<DefineConstants>TRACE;DEBUG;NET462</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;RELEASE;NET45</DefineConstants>
<DefineConstants>TRACE;RELEASE;NET462</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SignedRelease|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;RELEASE;NET45</DefineConstants>
<DefineConstants>TRACE;RELEASE;NET462</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>true</SignAssembly>
@@ -333,4 +333,4 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion Box.V2/Box.V2.nuspec
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<projectUrl>https://github.com/box/box-windows-sdk-v2</projectUrl>
<license type="expression">Apache-2.0</license>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Windows SDK for v2 of the Box API. The SDK is targeting .NET Framework 4.5</description>
<description>Windows SDK for v2 of the Box API. The SDK is targeting .NET Framework 4.6.2</description>
<releaseNotes>See https://github.com/box/box-windows-sdk-v2/blob/main/CHANGELOG.md#460-2022-10-18</releaseNotes>
<copyright>Copyright 2021</copyright>
<tags>Box V2 SDK Platform Enterprise Collaboration Storage File Management</tags>
35 changes: 15 additions & 20 deletions Box.V2/Managers/BoxResourceManager.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using Box.V2.Models;
using Box.V2.Services;
using Box.V2.Utility;
#if NET45
#if NET462
using Microsoft.Win32;
using System.Security;
#endif
@@ -308,7 +308,7 @@ protected string GetBoxUAHeader()

private string GetEnvNameAndVersion()
{
#if NET45
#if NET462
const string Subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";

RegistryKey ndpKey;
@@ -329,7 +329,7 @@ private string GetEnvNameAndVersion()
{
if (ndpKey != null && ndpKey.GetValue("Release") != null)
{
var frameworkVersion = CheckFor45PlusVersion((int)ndpKey.GetValue("Release"));
var frameworkVersion = CheckFor462PlusVersion((int)ndpKey.GetValue("Release"));
return frameworkVersion != null ? "env=.NET Framework/" + frameworkVersion : "";
}
else
@@ -347,33 +347,28 @@ FAIL THE BUILD
}

// Checking the version using >= will enable forward compatibility.
private string CheckFor45PlusVersion(int releaseKey)
private string CheckFor462PlusVersion(int releaseKey)
{
if (releaseKey >= 533320)
return "4.8.1+";

if (releaseKey >= 528040)
return "4.8";

if (releaseKey >= 461808)
return "4.7.2";

if (releaseKey >= 461308)
return "4.7.1+";
return "4.7.1";

if (releaseKey >= 460798)
return "4.7";

if (releaseKey >= 394802)
return "4.6.2";

if (releaseKey >= 394254)
return "4.6.1";

if (releaseKey >= 393295)
return "4.6";

if (releaseKey >= 379893)
return "4.5.2";

if (releaseKey >= 378675)
return "4.5.1";

if (releaseKey >= 378389)
return "4.5";
// This code should never execute. A non-null release key should mean
// that 4.5 or later is installed.
// that 4.6.2 or later is installed.
return null;
}

4 changes: 2 additions & 2 deletions Box.V2/Request/HttpRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class HttpRequestHandler : IRequestHandler
public HttpRequestHandler(IWebProxy webProxy = null, TimeSpan? timeout = null)
{
ClientFactory.WebProxy = webProxy;
#if NET45
#if NET462
System.Net.ServicePointManager.Expect100Continue = false;
#endif
_timeout = timeout ?? _defaultRequestTimeout;
@@ -292,7 +292,7 @@ private static HttpClient CreateClient(bool followRedirect, IWebProxy webProxy)
{
Debug.WriteLine("Could not set TLSv1.2 security protocol!");
}
#elif NET45
#elif NET462
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
#else
FAIL THE BUILD
12 changes: 6 additions & 6 deletions Box.V2/packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.9" targetFramework="net45" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.12.2" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Logging" version="6.12.2" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Tokens" version="6.12.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
<package id="System.IdentityModel.Tokens.Jwt" version="6.12.2" targetFramework="net45" />
<package id="BouncyCastle" version="1.8.9" targetFramework="net462" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.12.2" targetFramework="net462" />
<package id="Microsoft.IdentityModel.Logging" version="6.12.2" targetFramework="net462" />
<package id="Microsoft.IdentityModel.Tokens" version="6.12.2" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="System.IdentityModel.Tokens.Jwt" version="6.12.2" targetFramework="net462" />
</packages>
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Box Windows V2 SDK

[![Project Status](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges)
![Platform Framework](https://img.shields.io/badge/.NET%20Framework-%3E%3D4.5-blue)
![Platform Framework](https://img.shields.io/badge/.NET%20Framework-%3E%3D4.6.2-blue)
![Platform Core](https://img.shields.io/badge/.NET%20Core-%3E%3D2.0-blue)
[![License](https://img.shields.io/badge/license-Apache2-blue)](https://raw.githubusercontent.com/box/box-windows-sdk-v2/main/LICENSE)
[![Build](https://github.com/box/box-windows-sdk-v2/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/box/box-windows-sdk-v2/actions/workflows/build_and_test.yml)

The Box .NET SDK can be used to make API calls to the Box APIs in a .NET project.

The SDK is available for both .NET Framework 4.5 and .NET Core 2.0 or above. The installation of the SDK depends on the platform used.
The SDK is available for both .NET Framework 4.6.2 and .NET Core 2.0 or above. The installation of the SDK depends on the platform used.

## Table of contents

@@ -86,11 +86,16 @@ A current release is on the leading edge of our SDK development, and is intended

### Version schedule

| Version | Supported Environments | State | First Release | EOL/Terminated |
|---------|---------------------------------------|-----------|---------------|----------------|
| 4 | .NET Framework 4.5 and .NET Core 2.0+ | Supported | 02 Nov 2021 | TBD |
| 3 | | EOL | 28 Jul 2017 | 02 Nov 2021 |
| 2 | | EOL | 05 Nov 2015 | 28 Jul 2017 |
| Version | Supported Environments | State | First Release | EOL/Terminated |
|---------|------------------------------------------|-----------|---------------|----------------|
| 5 | .NET Framework 4.6.2+ and .NET Core 2.0+ | Supported | 02 Nov 2021 | TBD |
| 4 | .NET Framework 4.5+ and .NET Core 2.0+ | EOL | 02 Nov 2021 | TBD |
| 3 | | EOL | 28 Jul 2017 | 02 Nov 2021 |
| 2 | | EOL | 05 Nov 2015 | 28 Jul 2017 |

### Migrating from the old version?

If you are migrating from the old major version visit our [upgrade documentation](/docs/upgrades/).

## Questions, Bugs, and Feature Requests?

2 changes: 1 addition & 1 deletion build/variables.ps1
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ $NUGET_URL="https://api.nuget.org/v3/index.json"
$NET_CORE_VER="netcoreapp2.0"
$FRAMEWORK_ASSEMBLY_NAME="Box.V2"
$SLN_PATH="$ROOT_DIR" + "\Box.V2.sln"
$NET_FRAMEWORK_VER="net45"
$NET_FRAMEWORK_VER="net462"
$FRAMEWORK_PDB_PATH=$FRAMEWORK_PROJ_DIR + "\bin\Release\Box.V2.pdb"
$CORE_PDB_PATH=$CORE_PROJ_DIR + "\bin\Release\netstandard2.0\Box.V2.Core.pdb"
$PFX_PATH="$FRAMEWORK_PROJ_DIR" + "\BoxSDKKey.pfx"
49 changes: 49 additions & 0 deletions docs/upgrades/4.x.x to 5.x.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Upgrading from 4.x.x to 5.x.x

Follow the [General changes](#general-changes) to see the changes that are package indenpendent. Also refer to the [Box.V2](#box-v2) or
[Box.V2.Core](#box-v2-core) section depending on the package you are using.

## General changes

No changes

## Box.V2

### Minimal .NET runtime version upgrade

If you are still using .NET Framework version lower than 4.6.2 you need to upgrade to the 4.6.2+ version. You can do it by changing target framework in the .csproj file of your project.

For SDK-style projects

Before
```xml
<TargetFramework>net45<TargetFramework/>
```

After
```xml
<TargetFramework>net462<TargetFramework/>
```

See [SDK-style target framework](https://learn.microsoft.com/en-us/dotnet/standard/frameworks) for more information.

For non SDK-style projects

Before
```xml
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
```

After
```xml
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
```

See [MSBuild target framework](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2022) for more information

We recommend to upgrade to the newest version possible.
See [.NET Framework lifecycle](https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework)

## Box.V2.Core

No changes