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

Upgrade .net standard to 2.0 #755

Merged
merged 9 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions Box.V2.Core/Box.V2.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
<PackageReleaseNotes>See https://github.com/box/box-windows-sdk-v2/blob/main/CHANGELOG.md#3250-2020-10-19</PackageReleaseNotes>
<Copyright>Copyright 2020</Copyright>
<PackageTags>Box;V2;SDK;Platform;Enterprise;Collaboration;Storage;File Management</PackageTags>
<TargetFramework>netstandard1.6</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Box.V2.Core</AssemblyName>
<PackageId>Box.V2.Core</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand All @@ -28,17 +26,18 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETSTANDARD1_6</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Box.V2\**\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**;..\Box.V2\Properties\AssemblyInfo.cs;..\Box.V2\obj\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.4.0" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.10" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.13.1" />
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Box.V2.Samples.Core.AppUser.Create</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Box.V2.Samples.Core.AppUser.Create</PackageId>
<RuntimeIdentifiers>win10-x64;osx.10.10-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<RuntimeFrameworkVersion>2.0.9</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Box.V2.Samples.Core.File.Upload</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Box.V2.Samples.Core.File.Upload</PackageId>
<RuntimeIdentifiers>win10-x64;osx.10.10-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<RuntimeFrameworkVersion>2.0.9</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Box.V2.Samples.Core.HttpProxy</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Box.V2.Samples.Core.File.Upload</PackageId>
<RuntimeIdentifiers>win10-x64;osx.10.10-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<RuntimeFrameworkVersion>2.0.9</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand Down
179 changes: 41 additions & 138 deletions Box.V2.Test/Box.V2.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,144 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AA6B9D70-9314-43F8-A21D-773C814ED54E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Box.V2.Test</RootNamespace>
<AssemblyName>Box.V2.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>

<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</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</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Moq, Version=4.2.1312.1622, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Moq.4.2.1312.1622\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<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>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="BoxCollectionsManagerTest.cs" />
<Compile Include="BoxConfigTest.cs" />
<Compile Include="BoxEventsManagerTest.cs" />
<Compile Include="BoxJWTAuthTest.cs" />
<Compile Include="BoxMetadataCascadePolicyManagerTest.cs" />
<Compile Include="BoxMetadataManagerTest.cs" />
<Compile Include="BoxSharedItemsManagerTest.cs" />
<Compile Include="BoxResourcePluginsTest.cs" />
<Compile Include="AuthRepositoryTest.cs" />
<Compile Include="BoxFilesManagerTest.cs" />
<Compile Include="BoxGroupsManagerTest.cs" />
<Compile Include="BoxResourceManagerTest.cs" />
<Compile Include="BoxServiceTest.cs" />
<Compile Include="BoxSearchManagerTest.cs" />
<Compile Include="BoxStoragePoliciesManagerTest.cs" />
<Compile Include="BoxTasksManagerTest.cs" />
<Compile Include="BoxTermsOfServiceManagerTest.cs" />
<Compile Include="BoxUsersManagerTest.cs" />
<Compile Include="BoxCollaborationsManagerTest.cs" />
<Compile Include="BoxLegalHoldPoliciesManagerTest.cs" />
<Compile Include="BoxWebLinksManagerTest.cs" />
<Compile Include="BoxRetentionPoliciesManagerTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BoxRequestTest.cs" />
<Compile Include="BoxFoldersManagerTest.cs" />
<Compile Include="BoxCommentsManagerTest.cs" />
</ItemGroup>

<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<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="coverlet.collector" Version="1.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp2.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'))">
<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>
<ProjectReference Include="..\Box.V2\Box.V2.csproj">
<Project>{602ff1b8-df8b-4cff-88c6-8b34468c45ad}</Project>
<Name>Box.V2</Name>
</ProjectReference>
<None Update="TestData\smalltest.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>
2 changes: 1 addition & 1 deletion Box.V2.Test/BoxFilesManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ public async Task PromoteVersion_ValidResponse()
[TestCategory("CI-UNIT-TEST")]
public async Task DownloadZip_ValidResponse()
{
using (FileStream exampleFile = new FileStream(string.Format("../.././TestData/smalltest.pdf"), FileMode.OpenOrCreate))
using (FileStream exampleFile = new FileStream(string.Format(AppDomain.CurrentDomain.BaseDirectory + "/TestData/smalltest.pdf"), FileMode.OpenOrCreate))
{
/*** Arrange ***/
string responseStringCreateZip = "{\"download_url\": \"https://api.box.com/zip_downloads/124hfiowk3fa8kmrwh/content\",\"status_url\": \"https://api.box.com/zip_downloads/124hfiowk3fa8kmrwh/status\",\"expires_at\": \"2018-04-25T11:00:18-07:00\", \"name_conflicts\":[[{\"id\":\"100\",\"type\":\"file\",\"original_name\":\"salary.pdf\",\"download_name\":\"aqc823.pdf\"},{\"id\":\"200\",\"type\": \"file\",\"original_name\":\"salary.pdf\",\"download_name\": \"aci23s.pdf\"}],[{\"id\":\"1000\",\"type\": \"folder\",\"original_name\":\"employees\",\"download_name\":\"3d366a_employees\"},{\"id\":\"2000\",\"type\": \"folder\",\"original_name\":\"employees\",\"download_name\": \"3aa6a7_employees\"}]]}";
Expand Down
15 changes: 0 additions & 15 deletions Box.V2.Test/app.config

This file was deleted.

8 changes: 0 additions & 8 deletions Box.V2.Test/packages.config

This file was deleted.

2 changes: 1 addition & 1 deletion Box.V2/Managers/BoxResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private string GetEnvNameAndVersion()
return "";
}
}
#elif NETSTANDARD1_6
#elif NETSTANDARD2_0

string coreVersion = GetNetCoreVersion();
if (coreVersion != null)
Expand Down
2 changes: 1 addition & 1 deletion Box.V2/Request/HttpRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private static HttpClient CreateClient(bool followRedirect, IWebProxy webProxy)
}

// Ensure that clients use non-deprecated versions of TLS (i.e. TLSv1.1 or greater)
#if NETSTANDARD1_6
#if NETSTANDARD2_0
try
{
handler.SslProtocols |= System.Security.Authentication.SslProtocols.Tls12;
Expand Down
12 changes: 6 additions & 6 deletions Box.V2/Utility/CrossPlatform.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System;

#if NETSTANDARD1_6
#if NETSTANDARD2_0
using System.Reflection;
#endif

Expand All @@ -19,7 +19,7 @@ public static class CrossPlatform
/// <returns>true if able to convert.</returns>
public static bool CanConvert<T>(Type objectType)
{
#if NETSTANDARD1_6
#if NETSTANDARD2_0
return typeof(T).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
#else
return typeof(T).IsAssignableFrom(objectType);
Expand All @@ -32,13 +32,13 @@ public static bool CanConvert<T>(Type objectType)
/// <param name="targetType"></param>
/// <param name="sourceType"></param>
/// <returns>true if able to convert.</returns>
public static bool CanConvert(Type targetType,Type sourceType)
public static bool CanConvert(Type targetType, Type sourceType)
{
#if NETSTANDARD1_6
#if NETSTANDARD2_0
return targetType.GetTypeInfo().IsAssignableFrom(sourceType.GetTypeInfo());
#else
return targetType.IsAssignableFrom(sourceType);
#endif
}
}
}
}
Loading