diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a0c00a7a..92ac8087 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -12,7 +12,6 @@ pr: include: - main - variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' @@ -25,7 +24,6 @@ resources: name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release - extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: @@ -54,7 +52,7 @@ extends: inputs: targetType: filePath filePath: 'scripts\EnableSigning.ps1' - arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj"' + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"' pwsh: true enabled: true @@ -67,17 +65,17 @@ extends: # Build the Product project - task: DotNetCoreCLI@2 - displayName: 'Build Microsoft.Kiota.Abstractions' + displayName: 'Build projects in Microsoft.Kiota' inputs: - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln' + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' arguments: '--configuration $(BuildConfiguration) --no-incremental' # Run the Unit test - task: DotNetCoreCLI@2 - displayName: 'Test Microsoft.Kiota.Abstractions' + displayName: 'Test projects in Microsoft.Kiota' inputs: command: test - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln' + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' arguments: '--configuration $(BuildConfiguration) --no-build --framework net8.0' - task: EsrpCodeSigning@2 @@ -85,7 +83,7 @@ extends: inputs: ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' FolderPath: $(ProductBinPath) - Pattern: '**\*Microsoft.Kiota.Abstractions.dll' + Pattern: '**\*Microsoft.Kiota.*.dll' signConfigType: inlineSignParams UseMinimatch: true inlineOperation: | @@ -114,7 +112,7 @@ extends: FolderPath: src signConfigType: inlineSignParams UseMinimatch: true - Pattern: '**\*Microsoft.Kiota.Abstractions.dll' + Pattern: '**\*Microsoft.Kiota.*.dll' inlineOperation: | [ { @@ -156,7 +154,7 @@ extends: SessionTimeout: 20 # arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here - - pwsh: dotnet pack $env:BUILD_SOURCESDIRECTORY/src/Microsoft.Kiota.Abstractions.csproj /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION + - pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION env: BUILD_CONFIGURATION: $(BuildConfiguration) displayName: Dotnet pack @@ -167,7 +165,7 @@ extends: inputs: targetType: 'filePath' filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 - arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj" -packageName "Microsoft.Kiota.Abstractions"' + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"' pwsh: true - task: EsrpCodeSigning@2 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0cfda892..1e2d881f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -30,10 +30,10 @@ jobs: - name: Restore dependencies run: dotnet restore ${{ env.solutionName }} - name: Build - run: dotnet build ${{ env.solutionName }} --no-restore -c Release /p:UseSharedCompilation=false + run: dotnet build ${{ env.solutionName }} --no-restore /p:UseSharedCompilation=false - name: Test for net462 - run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release --framework net462 + run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal --framework net462 - name: Test for net8.0 and collect coverage - run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0 + run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/src/abstractions/35MSSharedLib1024.snk b/35MSSharedLib1024.snk similarity index 100% rename from src/abstractions/35MSSharedLib1024.snk rename to 35MSSharedLib1024.snk diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..a53219f2 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,57 @@ + + + + 2.0.0 + + + + false + + false + latest + enable + + + + Microsoft + © Microsoft Corporation. All rights reserved. + true + http://go.microsoft.com/fwlink/?LinkID=288890 + https://github.com/microsoft/kiota-dotnet + https://aka.ms/kiota/docs + + https://github.com/microsoft/kiota-dotnet/releases + + true + MIT + README.md + true + true + true + false + false + 35MSSharedLib1024.snk + true + $(NoWarn);NU5048;NETSDK1138 + true + true + true + + + + false + Library + + + + + True + + + + + + + + + \ No newline at end of file diff --git a/scripts/EnableSigning.ps1 b/scripts/EnableSigning.ps1 index b17ac820..ace3bf18 100644 --- a/scripts/EnableSigning.ps1 +++ b/scripts/EnableSigning.ps1 @@ -28,6 +28,12 @@ $delaySign.'#text' = "true" $signAssembly = $doc.SelectSingleNode("//SignAssembly"); $signAssembly.'#text' = "true" +# Set the AssemblyOriginatorKeyFile to an absolute path to resolve any path resolution issues. +# Assumption: The key file is in the same directory as the project file. +$dirName = [System.IO.Path]::GetDirectoryName([System.IO.Path]::GetFullPath($projectPath)) +$assemblyOriginatorKeyFile = $doc.SelectSingleNode("//AssemblyOriginatorKeyFile"); +$assemblyOriginatorKeyFile.'#text' = Join-Path $dirName $assemblyOriginatorKeyFile.'#text' + $doc.Save($projectPath); -Write-Host "Updated the .csproj file so that we can sign the built assemblies." -ForegroundColor Green \ No newline at end of file +Write-Host "Updated the project file so that we can sign the built assemblies." -ForegroundColor Green \ No newline at end of file diff --git a/src/abstractions/Microsoft.Kiota.Abstractions.csproj b/src/abstractions/Microsoft.Kiota.Abstractions.csproj index 41d8dbac..999ed0c8 100644 --- a/src/abstractions/Microsoft.Kiota.Abstractions.csproj +++ b/src/abstractions/Microsoft.Kiota.Abstractions.csproj @@ -3,47 +3,13 @@ Abstractions library for the Kiota generated SDKs in dotnet. - © Microsoft Corporation. All rights reserved. Kiota Abstractions Library for dotnet - Microsoft netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.9.7 - - true - false - false - 35MSSharedLib1024.snk true - latest - enable - true - - - - https://github.com/microsoft/kiota-dotnet/releases - - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138 - - - true - - - true - @@ -51,15 +17,4 @@ - - - true - - - - - True - - - diff --git a/src/authentication/azure/35MSSharedLib1024.snk b/src/authentication/azure/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/authentication/azure/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/authentication/azure/Microsoft.Kiota.Authentication.Azure.csproj b/src/authentication/azure/Microsoft.Kiota.Authentication.Azure.csproj index 5608d79f..c300e798 100644 --- a/src/authentication/azure/Microsoft.Kiota.Authentication.Azure.csproj +++ b/src/authentication/azure/Microsoft.Kiota.Authentication.Azure.csproj @@ -3,47 +3,13 @@ Kiota authentication provider implementation with Azure Identity. - © Microsoft Corporation. All rights reserved. Kiota Azure Identity Authentication Library for dotnet - Microsoft netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.1.7 - true - true - - - false - false - 35MSSharedLib1024.snk - latest - enable - true - - https://github.com/microsoft/kiota-dotnet/releases - - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138 - - - true - - - true - @@ -52,16 +18,4 @@ - - - true - - - - - True - - - - diff --git a/src/generated/KiotaGenerated.csproj b/src/generated/KiotaGenerated.csproj index da471e4f..6ed1f276 100644 --- a/src/generated/KiotaGenerated.csproj +++ b/src/generated/KiotaGenerated.csproj @@ -1,9 +1,11 @@ - + + Source Generator project to assembly info as source such as package version. netstandard2.0 - latest true + true + false diff --git a/src/generated/KiotaVersionGenerator.cs b/src/generated/KiotaVersionGenerator.cs index 73e9a92a..2205af08 100644 --- a/src/generated/KiotaVersionGenerator.cs +++ b/src/generated/KiotaVersionGenerator.cs @@ -14,17 +14,17 @@ public void Execute(GeneratorExecutionContext context) var mainSyntaxTree = context.Compilation.SyntaxTrees .First(static x => x.HasCompilationUnitRoot); - var directory = Path.GetDirectoryName(mainSyntaxTree.FilePath); + var projectDirectory = Path.GetDirectoryName(mainSyntaxTree.FilePath); var version = "unknown"; try { XmlDocument csproj = new XmlDocument(); - csproj.Load(Path.Combine(directory, "..", "Microsoft.Kiota.Http.HttpClientLibrary.csproj")); - + projectDirectory = Path.Combine(projectDirectory, "..", "..", "..", "..", "Directory.Build.props"); + csproj.Load(projectDirectory); version = csproj.GetElementsByTagName("VersionPrefix")[0].InnerText; } catch (Exception e) { - throw new FileNotFoundException("KiotaVersionGenerator expanded in an invalid project, missing 'Microsoft.Kiota.Http.HttpClientLibrary.csproj' file.", e); + throw new FileNotFoundException($"KiotaVersionGenerator expanded in an invalid project, missing 'Directory.Build.props' file in the following directory {projectDirectory}", e); } string source = $@"// diff --git a/src/http/httpClient/35MSSharedLib1024.snk b/src/http/httpClient/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/http/httpClient/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj index 40d5385f..21ff350b 100644 --- a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj +++ b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj @@ -3,70 +3,24 @@ Kiota Http provider implementation for dotnet with HttpClient. - © Microsoft Corporation. All rights reserved. Kiota Http Library for dotnet - Microsoft netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.4.3 - - true - - - false - false - 35MSSharedLib1024.snk - - https://github.com/microsoft/kiota-dotnet/releases - - true - MIT true - README.md - latest - enable - true - $(NoWarn);NU5048;NETSDK1138 - - true - - - true - - - - - + + - - - true - - - - - True - - - diff --git a/src/http/httpClient/Properties/AssemblyInfo.cs b/src/http/httpClient/Properties/AssemblyInfo.cs index f5d42b2e..3ef9220f 100644 --- a/src/http/httpClient/Properties/AssemblyInfo.cs +++ b/src/http/httpClient/Properties/AssemblyInfo.cs @@ -17,4 +17,8 @@ [assembly: Guid("b0c91cbc-af85-4c64-b989-d320e6989b2a")] -[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests")] \ No newline at end of file +#if DEBUG +[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests")] +#else +[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +#endif \ No newline at end of file diff --git a/src/serialization/form/35MSSharedLib1024.snk b/src/serialization/form/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/serialization/form/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/serialization/form/Microsoft.Kiota.Serialization.Form.csproj b/src/serialization/form/Microsoft.Kiota.Serialization.Form.csproj index 599005ea..554f9392 100644 --- a/src/serialization/form/Microsoft.Kiota.Serialization.Form.csproj +++ b/src/serialization/form/Microsoft.Kiota.Serialization.Form.csproj @@ -3,59 +3,11 @@ Kiota URI form encoded serialization provider. - © Microsoft Corporation. All rights reserved. Kiota URI form encoded serialization provider. - Microsoft + netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - enable - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.2.5 - - true true - latest - true - enable - - - false - false - 35MSSharedLib1024.snk - - https://github.com/microsoft/kiota-dotnet/releases - - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138 - - true - - - true - - - - - - - - true - - - - - True - - - diff --git a/src/serialization/json/35MSSharedLib1024.snk b/src/serialization/json/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/serialization/json/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/serialization/json/Microsoft.Kiota.Serialization.Json.csproj b/src/serialization/json/Microsoft.Kiota.Serialization.Json.csproj index 7da40bc8..0a0cd3f6 100644 --- a/src/serialization/json/Microsoft.Kiota.Serialization.Json.csproj +++ b/src/serialization/json/Microsoft.Kiota.Serialization.Json.csproj @@ -3,65 +3,18 @@ Kiota JSON serialization provider implementation with System.Text.Json. - © Microsoft Corporation. All rights reserved. Kiota JSON Serialization Library for dotnet using System.Text.Json - Microsoft netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.3.3 - - true true - - - false - false - 35MSSharedLib1024.snk - - https://github.com/microsoft/kiota-dotnet/releases - - latest - enable - true - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138;CS1591 + $(NoWarn);CS1591 - - true - - - true - - - - - - - true - - - - - True - - - - diff --git a/src/serialization/multipart/35MSSharedLib1024.snk b/src/serialization/multipart/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/serialization/multipart/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.csproj b/src/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.csproj index 4c649cf7..ebaf50ca 100644 --- a/src/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.csproj +++ b/src/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.csproj @@ -3,58 +3,11 @@ Kiota Multipart serialization provider implementation. - © Microsoft Corporation. All rights reserved. Kiota Multipart Serialization Library for dotnet - Microsoft + netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.1.5 - - true true - - - false - false - 35MSSharedLib1024.snk - - https://github.com/microsoft/kiota-dotnet/releases - - latest - enable - true - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138 - - true - - - true - - - - - - - - true - - - - - True - - - diff --git a/src/serialization/text/35MSSharedLib1024.snk b/src/serialization/text/35MSSharedLib1024.snk deleted file mode 100644 index 695f1b38..00000000 Binary files a/src/serialization/text/35MSSharedLib1024.snk and /dev/null differ diff --git a/src/serialization/text/Microsoft.Kiota.Serialization.Text.csproj b/src/serialization/text/Microsoft.Kiota.Serialization.Text.csproj index 392e86ad..1dd40038 100644 --- a/src/serialization/text/Microsoft.Kiota.Serialization.Text.csproj +++ b/src/serialization/text/Microsoft.Kiota.Serialization.Text.csproj @@ -1,59 +1,13 @@ + Text/plain serialization provider implementation for Kiota based SDKs. - © Microsoft Corporation. All rights reserved. Text/plain serialization Kiota library for dotnet - Microsoft + netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0 - latest - true - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/microsoft/kiota-dotnet - https://aka.ms/kiota/docs - true - true - 1.2.2 - - true - false - false - 35MSSharedLib1024.snk true - latest - enable - true - - - - https://github.com/microsoft/kiota-dotnet/releases - - true - MIT - README.md - $(NoWarn);NU5048;NETSDK1138 - - true - - - true - - - - - - - - true - - - - - True - - - diff --git a/tests/abstractions/Microsoft.Kiota.Abstractions.Tests.csproj b/tests/abstractions/Microsoft.Kiota.Abstractions.Tests.csproj index 546eaae6..df8027cf 100644 --- a/tests/abstractions/Microsoft.Kiota.Abstractions.Tests.csproj +++ b/tests/abstractions/Microsoft.Kiota.Abstractions.Tests.csproj @@ -1,11 +1,9 @@ - + - false - net462;net8.0 - latest - Library true + net8.0;net462 + disable diff --git a/tests/authentication/azure/Microsoft.Kiota.Authentication.Azure.Tests.csproj b/tests/authentication/azure/Microsoft.Kiota.Authentication.Azure.Tests.csproj index c0412b9d..da531069 100644 --- a/tests/authentication/azure/Microsoft.Kiota.Authentication.Azure.Tests.csproj +++ b/tests/authentication/azure/Microsoft.Kiota.Authentication.Azure.Tests.csproj @@ -1,10 +1,9 @@ - + net8.0;net462 - latest - false true + disable diff --git a/tests/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.Tests.csproj b/tests/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.Tests.csproj index 955fe9aa..9dd2aa46 100644 --- a/tests/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.Tests.csproj +++ b/tests/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.Tests.csproj @@ -1,13 +1,9 @@ - + net8.0;net462 - false - latest - Library - false - ..\src\35MSSharedLib1024.snk - false + true + disable @@ -33,5 +29,4 @@ - diff --git a/tests/serialization/form/Microsoft.Kiota.Serialization.Form.Tests.csproj b/tests/serialization/form/Microsoft.Kiota.Serialization.Form.Tests.csproj index 9db87b7a..dfedea5e 100644 --- a/tests/serialization/form/Microsoft.Kiota.Serialization.Form.Tests.csproj +++ b/tests/serialization/form/Microsoft.Kiota.Serialization.Form.Tests.csproj @@ -1,11 +1,10 @@ - + net8.0;net462 - enable + true + true enable - latest - false diff --git a/tests/serialization/json/Microsoft.Kiota.Serialization.Json.Tests.csproj b/tests/serialization/json/Microsoft.Kiota.Serialization.Json.Tests.csproj index 5d4b4a8a..0735661d 100644 --- a/tests/serialization/json/Microsoft.Kiota.Serialization.Json.Tests.csproj +++ b/tests/serialization/json/Microsoft.Kiota.Serialization.Json.Tests.csproj @@ -1,10 +1,9 @@ - + net8.0;net462 - false - latest - Library + true + disable diff --git a/tests/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.Tests.csproj b/tests/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.Tests.csproj index d049cffe..70a3e0ce 100644 --- a/tests/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.Tests.csproj +++ b/tests/serialization/multipart/Microsoft.Kiota.Serialization.Multipart.Tests.csproj @@ -1,10 +1,9 @@ - + net8.0;net462 - false - latest - Library + true + disable diff --git a/tests/serialization/text/Microsoft.Kiota.Serialization.Text.Tests.csproj b/tests/serialization/text/Microsoft.Kiota.Serialization.Text.Tests.csproj index 814a979f..c214e2b4 100644 --- a/tests/serialization/text/Microsoft.Kiota.Serialization.Text.Tests.csproj +++ b/tests/serialization/text/Microsoft.Kiota.Serialization.Text.Tests.csproj @@ -1,13 +1,8 @@ - + net8.0;net462 - enable - latest - false - false - ..\src\35MSSharedLib1024.snk - false + true