Skip to content

Commit

Permalink
feat!: upgrade .net framework to 4.6.2 (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwwoda authored Nov 30, 2022
1 parent f5915b3 commit 38dc8e7
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 77 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
framework:
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
branches:
- main

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

jobs:
build:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/spell-check-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion Box.V2.Samples.JWTAuth/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down
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>
Expand All @@ -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>
Expand Down
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>
Expand Down
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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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
Expand Up @@ -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>
Expand Down
35 changes: 15 additions & 20 deletions Box.V2/Managers/BoxResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions Box.V2/Request/HttpRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
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

Expand Down Expand Up @@ -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?

Expand Down
2 changes: 1 addition & 1 deletion build/variables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 38dc8e7

Please sign in to comment.