Skip to content

Commit 1342794

Browse files
authored
Merge pull request #137 from microsoft/feature/net5
feature/net6
2 parents 37b222f + 094bf81 commit 1342794

File tree

16 files changed

+53
-303
lines changed

16 files changed

+53
-303
lines changed

.github/ISSUE_TEMPLATE/workflows/azure-pipelines_nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ variables:
2929

3030
steps:
3131

32+
- task: UseDotNet@2
33+
displayName: 'Use .NET 6'
34+
inputs:
35+
version: 6.x
36+
3237
- task: PoliCheck@1
3338
displayName: 'Run PoliCheck "OpenApi.OData-master\src"'
3439
inputs:

.github/ISSUE_TEMPLATE/workflows/azure-pipelines_rolling.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ variables:
2727

2828
steps:
2929

30+
- task: UseDotNet@2
31+
displayName: 'Use .NET 6'
32+
inputs:
33+
version: 6.x
34+
3035
- task: PoliCheck@1
3136
displayName: 'Run PoliCheck ".\src"'
3237
inputs:

src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<AssemblyName>Microsoft.OpenApi.OData.Reader</AssemblyName>
@@ -19,12 +19,12 @@
1919
<Import Project="..\Build.props" />
2020

2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.2">
22+
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>
26-
<PackageReference Include="Microsoft.OData.Edm" Version="7.6.1" />
27-
<PackageReference Include="Microsoft.OpenApi" Version="1.2.2" />
26+
<PackageReference Include="Microsoft.OData.Edm" Version="7.9.4" />
27+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
2828
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
2929
<PrivateAssets>all</PrivateAssets>
3030
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/OoasGui/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/OoasGui/MainForm.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
using Microsoft.OpenApi.Extensions;
1717
using Microsoft.OpenApi.Models;
1818
using Microsoft.OpenApi.OData;
19-
using System.Net;
2019
using System.Xml;
2120
using System.Threading.Tasks;
21+
using System.Net.Http;
2222

2323
namespace OoasGui
2424
{
@@ -120,6 +120,8 @@ private async void btnBrowse_Click(object sender, EventArgs e)
120120
}
121121
}
122122

123+
private static HttpClient client = new();
124+
123125
private async void loadBtn_Click(object sender, EventArgs e)
124126
{
125127
string url = urlTextBox.Text;
@@ -136,15 +138,10 @@ private async void loadBtn_Click(object sender, EventArgs e)
136138
requestUri = new Uri(url + "/$metadata");
137139
}
138140

139-
WebRequest request = WebRequest.Create(requestUri);
140-
141-
WebResponse response = request.GetResponse();
142-
143-
Stream receivedStream = response.GetResponseStream();
141+
HttpResponseMessage response = await client.GetAsync(requestUri);
144142

145-
StreamReader reader = new StreamReader(receivedStream, Encoding.UTF8);
143+
string csdl = await response.Content.ReadAsStringAsync();
146144

147-
string csdl = reader.ReadToEnd();
148145
LoadEdm(url, csdl);
149146
csdlRichTextBox.Text = FormatXml(csdl);
150147
Settings.ServiceRoot = requestUri;

src/OoasGui/OoasGui.csproj

Lines changed: 10 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,23 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{79B190E8-EDB0-4C03-8FD8-EB48E4807CFB}</ProjectGuid>
3+
<TargetFramework>net6.0-windows</TargetFramework>
84
<OutputType>WinExe</OutputType>
9-
<RootNamespace>OoasGui</RootNamespace>
10-
<AssemblyName>OoasGui</AssemblyName>
11-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12-
<FileAlignment>512</FileAlignment>
13-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14-
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<PlatformTarget>AnyCPU</PlatformTarget>
17-
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\</OutputPath>
21-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
</PropertyGroup>
25-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26-
<PlatformTarget>AnyCPU</PlatformTarget>
27-
<DebugType>pdbonly</DebugType>
28-
<Optimize>true</Optimize>
29-
<OutputPath>bin\Release\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
31-
<ErrorReport>prompt</ErrorReport>
32-
<WarningLevel>4</WarningLevel>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
338
</PropertyGroup>
349
<ItemGroup>
35-
<Reference Include="Microsoft.OData.Edm, Version=7.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
36-
<HintPath>..\..\packages\Microsoft.OData.Edm.7.6.1\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
37-
</Reference>
38-
<Reference Include="Microsoft.OpenApi, Version=1.2.2.0, Culture=neutral, PublicKeyToken=3f5743946376f042, processorArchitecture=MSIL">
39-
<HintPath>..\..\packages\Microsoft.OpenApi.1.2.2\lib\net46\Microsoft.OpenApi.dll</HintPath>
40-
</Reference>
41-
<Reference Include="System" />
42-
<Reference Include="System.Core" />
43-
<Reference Include="System.Xml.Linq" />
44-
<Reference Include="System.Data.DataSetExtensions" />
45-
<Reference Include="Microsoft.CSharp" />
46-
<Reference Include="System.Data" />
47-
<Reference Include="System.Deployment" />
48-
<Reference Include="System.Drawing" />
49-
<Reference Include="System.Net.Http" />
50-
<Reference Include="System.Windows.Forms" />
51-
<Reference Include="System.Xml" />
52-
</ItemGroup>
53-
<ItemGroup>
54-
<Compile Include="MainForm.cs">
55-
<SubType>Form</SubType>
56-
</Compile>
57-
<Compile Include="MainForm.Designer.cs">
58-
<DependentUpon>MainForm.cs</DependentUpon>
59-
</Compile>
60-
<Compile Include="Program.cs" />
61-
<Compile Include="Properties\AssemblyInfo.cs" />
62-
<EmbeddedResource Include="MainForm.resx">
63-
<DependentUpon>MainForm.cs</DependentUpon>
64-
</EmbeddedResource>
65-
<EmbeddedResource Include="Properties\Resources.resx">
66-
<Generator>ResXFileCodeGenerator</Generator>
67-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
68-
<SubType>Designer</SubType>
69-
</EmbeddedResource>
70-
<Compile Include="Properties\Resources.Designer.cs">
71-
<AutoGen>True</AutoGen>
72-
<DependentUpon>Resources.resx</DependentUpon>
73-
</Compile>
7410
<None Include="..\..\.editorconfig">
7511
<Link>.editorconfig</Link>
7612
</None>
77-
<None Include="packages.config" />
78-
<None Include="Properties\Settings.settings">
79-
<Generator>SettingsSingleFileGenerator</Generator>
80-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
81-
</None>
82-
<Compile Include="Properties\Settings.Designer.cs">
83-
<AutoGen>True</AutoGen>
84-
<DependentUpon>Settings.settings</DependentUpon>
85-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
86-
</Compile>
8713
</ItemGroup>
8814
<ItemGroup>
89-
<None Include="App.config" />
15+
<ProjectReference Include="..\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj" />
9016
</ItemGroup>
9117
<ItemGroup>
92-
<ProjectReference Include="..\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj">
93-
<Project>{ff3acd93-19e0-486c-9c0f-fa1c2e7fc8c2}</Project>
94-
<Name>Microsoft.OpenApi.OData.Reader</Name>
95-
</ProjectReference>
18+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
19+
<PackageReference Include="Microsoft.OData.Edm" Version="7.9.4" />
20+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
21+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
9622
</ItemGroup>
97-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9823
</Project>

src/OoasGui/packages.config

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/OoasUtil/OoasUtil.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net472</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

src/OoasUtil/UrlOpenApiGenerator.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
//---------------------------------------------------------------------
66

77
using System;
8-
using System.Net;
9-
using System.IO;
10-
using System.Text;
118
using System.Xml.Linq;
129
using Microsoft.OData.Edm;
1310
using Microsoft.OData.Edm.Csdl;
1411
using Microsoft.OpenApi;
1512
using Microsoft.OpenApi.OData;
13+
using System.Net.Http;
14+
using System.Threading.Tasks;
1615

1716
namespace OoasUtil
1817
{
@@ -44,20 +43,17 @@ public UrlOpenApiGenerator(Uri input, string output, OpenApiFormat format, OpenA
4443
/// </summary>
4544
protected override IEdmModel GetEdmModel()
4645
{
47-
Uri requestUri = new Uri(Input.OriginalString + "/$metadata");
46+
Uri requestUri = new (Input.OriginalString + "/$metadata");
4847

49-
WebRequest request = WebRequest.Create(requestUri);
50-
51-
WebResponse response = request.GetResponse();
52-
53-
Stream receivedStream = response.GetResponseStream();
54-
55-
StreamReader reader = new StreamReader(receivedStream, Encoding.UTF8);
56-
57-
string csdl = reader.ReadToEnd();
48+
string csdl = GetModelDocumentAsync(requestUri).GetAwaiter().GetResult();
5849

5950
return CsdlReader.Parse(XElement.Parse(csdl).CreateReader());
6051
}
52+
private async Task<string> GetModelDocumentAsync(Uri requestUri) {
53+
HttpResponseMessage response = await client.GetAsync(requestUri);
54+
return await response.Content.ReadAsStringAsync();
55+
}
56+
private static readonly HttpClient client = new ();
6157

6258
protected override void ModifySettings()
6359
{

test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<AssemblyName>Microsoft.OpenApi.OData.Reader.Tests</AssemblyName>
55
<RootNamespace>Microsoft.OpenApi.OData.Reader.Tests</RootNamespace>
6-
<TargetFrameworks>net472;netcoreapp2.1</TargetFrameworks>
6+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
77
<SignAssembly>true</SignAssembly>
88
<AssemblyOriginatorKeyFile>..\..\tool\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
99
<DelaySign>true</DelaySign>
@@ -61,10 +61,10 @@
6161
</ItemGroup>
6262

6363
<ItemGroup>
64-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
65-
<PackageReference Include="Microsoft.OpenApi" Version="1.2.2" />
64+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
65+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
6666
<PackageReference Include="xunit" Version="2.4.1" />
67-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
67+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
6868
<PrivateAssets>all</PrivateAssets>
6969
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7070
</PackageReference>

tool/UpdateDocs/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static int Main(string[] args)
7474
output = oas20 + "/" + fileName + ".json";
7575
File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0));
7676

77-
Console.WriteLine("Output [ " + fileName + " ] Succeessful!");
77+
Console.WriteLine("Output [ " + fileName + " ] Successful!");
7878
}
7979

8080
Console.WriteLine("\n==> All Done!");

tool/UpdateDocs/UpdateDocs.csproj

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,18 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{6D5453C2-E35F-4CC6-B774-4C676F5F33D1}</ProjectGuid>
3+
<TargetFramework>net6.0</TargetFramework>
84
<OutputType>Exe</OutputType>
9-
<RootNamespace>UpdateDocs</RootNamespace>
10-
<AssemblyName>UpdateDocs</AssemblyName>
11-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12-
<FileAlignment>512</FileAlignment>
13-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
146
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<PlatformTarget>AnyCPU</PlatformTarget>
17-
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\net461\</OutputPath>
21-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
</PropertyGroup>
25-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26-
<PlatformTarget>AnyCPU</PlatformTarget>
27-
<DebugType>pdbonly</DebugType>
28-
<Optimize>true</Optimize>
29-
<OutputPath>bin\Release\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
31-
<ErrorReport>prompt</ErrorReport>
32-
<WarningLevel>4</WarningLevel>
33-
</PropertyGroup>
34-
<ItemGroup>
35-
<Reference Include="Microsoft.OData.Edm, Version=7.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
36-
<HintPath>packages\Microsoft.OData.Edm.7.6.1\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
37-
</Reference>
38-
<Reference Include="Microsoft.OpenApi, Version=1.2.2.0, Culture=neutral, PublicKeyToken=3f5743946376f042, processorArchitecture=MSIL">
39-
<HintPath>packages\Microsoft.OpenApi.1.2.2\lib\net46\Microsoft.OpenApi.dll</HintPath>
40-
</Reference>
41-
<Reference Include="System" />
42-
<Reference Include="System.Core" />
43-
<Reference Include="System.Xml.Linq" />
44-
<Reference Include="System.Data.DataSetExtensions" />
45-
<Reference Include="Microsoft.CSharp" />
46-
<Reference Include="System.Data" />
47-
<Reference Include="System.Net.Http" />
48-
<Reference Include="System.Xml" />
49-
</ItemGroup>
507
<ItemGroup>
51-
<Compile Include="Program.cs" />
52-
<Compile Include="Properties\AssemblyInfo.cs" />
8+
<ProjectReference Include="..\..\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj" />
539
</ItemGroup>
5410
<ItemGroup>
55-
<ProjectReference Include="..\..\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj">
56-
<Project>{ff3acd93-19e0-486c-9c0f-fa1c2e7fc8c2}</Project>
57-
<Name>Microsoft.OpenApi.OData.Reader</Name>
58-
</ProjectReference>
11+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
12+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
5913
</ItemGroup>
6014
<ItemGroup>
61-
<None Include="packages.config" />
15+
<PackageReference Include="Microsoft.OData.Edm" Version="7.9.4" />
16+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
6217
</ItemGroup>
63-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6418
</Project>

tool/UpdateDocs/UpdateDocs.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateDocs", "UpdateDocs.cs
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.OData.Reader", "..\..\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj", "{B7A15A06-0B61-4557-9BD4-0E4F32DE119D}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateDocsCore", "..\UpdateDocsCore\UpdateDocsCore.csproj", "{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}"
11-
EndProject
1210
Global
1311
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1412
Debug|Any CPU = Debug|Any CPU
@@ -23,10 +21,6 @@ Global
2321
{B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Debug|Any CPU.Build.0 = Debug|Any CPU
2422
{B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Release|Any CPU.ActiveCfg = Release|Any CPU
2523
{B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Release|Any CPU.Build.0 = Release|Any CPU
3024
EndGlobalSection
3125
GlobalSection(SolutionProperties) = preSolution
3226
HideSolutionNode = FALSE

tool/UpdateDocs/packages.config

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)