Skip to content

Commit

Permalink
MSOF-113 upgrade SDK to .NET Standard 2.0 (#24)
Browse files Browse the repository at this point in the history
* MSOF-113 upgrade dotnet sdk to netstandard2.0

* MSOF-113 update build targeting .NET 7

* MSOF-113 move to dotnet cli

* MSOF-113 fix github actions reference for dotnet

* MSOF-113 fix dll reference for code signing

* MSOF-113 move nuget pack to dotnet pack

* MSOF-113 set output param for nuget pack

* MSOF-113 remove .net framework legacy, add assembly information

* MSOF-113 add assembly visibility for testproject

* MSOF-113 add versioning info in pipeline

* MSOF-113 update nuget packages
  • Loading branch information
mscc-sascha committed Sep 21, 2023
1 parent d8a8f48 commit 589b289
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 310 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/dotnetSDK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,38 @@ jobs:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET 5.0.x
uses: actions/setup-dotnet@v1
- name: Install .NET 7.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.x
dotnet-version: 7.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v1.1

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration /p:Platform="Any CPU"
run: dotnet restore $env:Solution_Name

# Build SDK
- name: Build
shell: powershell
run: |
$version = git describe --abbrev=0 --tags
$version = $version.substring(1) + "." + $env:BUILD_NUMBER
msbuild $env:Solution_Name /t:rebuild /p:Configuration=$env:Configuration /p:Version=$version /p:Platform="Any CPU"
dotnet build $env:Solution_Name --configuration $env:Configuration -p:Version=$version -p:Platform="Any CPU"
# Run Test Project
- name: Test
run: |
'& "$(vswhere -property installationPath)\Common7\IDE\MSTest.exe" /testcontainer:"Acrolinx.Net\Acrolinx.Net.Tests\bin\Release\Acrolinx.Net.Tests.dll" /resultsfile:"Acrolinx.Net\Acrolinx.Net\bin\Release\testResult.xml"'
run: |
'& dotnet test Acrolinx.Net\Acrolinx.Net.Tests\bin\Release\net7.0\Acrolinx.Net.Tests.dll -l:trx;LogFileName=Acrolinx.Net\Acrolinx.Net\bin\Release\testResult.xml'
# Sign the dll
- name: Code signing
env:
CERTIFICATE: ${{ secrets.CERTIFICATE }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
BINARY: "Acrolinx.Net/Acrolinx.Net/bin/Release/Acrolinx.Net.dll"
BINARY: "Acrolinx.Net/Acrolinx.Net/bin/Release/netstandard2.0/Acrolinx.Net.dll"
SIGNTOOL: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe"
shell: powershell
run: |
Expand All @@ -87,7 +87,7 @@ jobs:
run: |
$version = git describe --abbrev=0 --tags
$version = $version.substring(1) + "." + $env:BUILD_NUMBER
nuget pack ".\Acrolinx.Net\Acrolinx.Net\Acrolinx.Net.csproj" -properties Configuration=Release -symbols
dotnet pack ".\Acrolinx.Net\Acrolinx.Net\Acrolinx.Net.csproj" -p:Version=$version --configuration=Release --include-symbols --output ./
# Change source of nuget package to Github, to publish on Github registry
- name: Add nuget source to github (replacement for nexus)
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
with:
files: |
*.nupkg
Acrolinx.Net/Acrolinx.Net/bin/Release/
Acrolinx.Net/Acrolinx.Net/bin/Release/netstandard2.0/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -131,4 +131,4 @@ jobs:
name: dotNetSDK_Artifacts
path: |
*.nupkg
Acrolinx.Net/Acrolinx.Net/bin/Release/
Acrolinx.Net/Acrolinx.Net/bin/Release/netstandard2.0/
127 changes: 17 additions & 110 deletions Acrolinx.Net/Acrolinx.Net.Tests/Acrolinx.Net.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,116 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{61A6F6BF-1B80-4941-AEFD-8C9A9BFDA56E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Acrolinx.Net.Tests</RootNamespace>
<AssemblyName>Acrolinx.Net.Tests</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 />
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</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>
<Prefer32Bit>false</Prefer32Bit>
</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>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</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="EndpointTest.cs" />
<Compile Include="TestEnvironment.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acrolinx.Net\Acrolinx.Net.csproj">
<Project>{b97f26d4-909b-4093-a9ba-e436a4842569}</Project>
<Name>Acrolinx.Net</Name>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<None Include="app.config" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client">
<Version>5.2.7</Version>
</PackageReference>
<PackageReference Include="Moq">
<Version>4.14.5</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<ProjectReference Include="..\Acrolinx.Net\Acrolinx.Net.csproj" />
</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" />
<!-- 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>
4 changes: 0 additions & 4 deletions Acrolinx.Net/Acrolinx.Net.Tests/EndpointTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@
* limitations under the License.
*/

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using Acrolinx.Net.Acrolinx.Net;
using Acrolinx.Net.Check;
using Acrolinx.Net.Exceptions;
using Acrolinx.Net.Utils;
using Moq;
using System.Threading;
using System;

namespace Acrolinx.Net.Tests
{
Expand Down
1 change: 1 addition & 0 deletions Acrolinx.Net/Acrolinx.Net.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using Microsoft.VisualStudio.TestTools.UnitTesting;
36 changes: 0 additions & 36 deletions Acrolinx.Net/Acrolinx.Net.Tests/Properties/AssemblyInfo.cs

This file was deleted.

1 change: 0 additions & 1 deletion Acrolinx.Net/Acrolinx.Net.Tests/TestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

using System;
using System.Diagnostics;

namespace Acrolinx.Net.Tests
Expand Down
9 changes: 4 additions & 5 deletions Acrolinx.Net/Acrolinx.Net.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acrolinx.Net", "Acrolinx.Net\Acrolinx.Net.csproj", "{B97F26D4-909B-4093-A9BA-E436A4842569}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acrolinx.Net", "Acrolinx.Net\Acrolinx.Net.csproj", "{B97F26D4-909B-4093-A9BA-E436A4842569}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acrolinx.Net.Tests", "Acrolinx.Net.Tests\Acrolinx.Net.Tests.csproj", "{61A6F6BF-1B80-4941-AEFD-8C9A9BFDA56E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acrolinx.Net.Tests", "Acrolinx.Net.Tests\Acrolinx.Net.Tests.csproj", "{61A6F6BF-1B80-4941-AEFD-8C9A9BFDA56E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Loading

0 comments on commit 589b289

Please sign in to comment.