diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f9b40dff..ef4ad775 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,9 +29,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 + id: installdotnet with: dotnet-version: 7.0.x + - name: Create temporary global.json + run: echo '{"sdk":{"version":"${{ steps.installdotnet.outputs.dotnet-version }}"}}' > ./global.json + # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which # will preserve the dependency order and configuration of the *.sln diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs index ed1e996b..f675197b 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs @@ -81,7 +81,14 @@ public virtual void OnProvidersExecuting( ApplicationModelProviderContext contex { var controller = controllers[i]; - controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + if ( controller.RouteValues.TryGetValue( "controller", out var name ) ) + { + controller.ControllerName = name!; + } + else + { + controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + } if ( !ConventionBuilder.ApplyTo( controller ) ) { diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj index a11e441f..f08faa61 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj @@ -1,7 +1,7 @@  - 7.1.0 + 7.1.1 7.1.0.0 net7.0 Asp.Versioning diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt index 5f282702..525fc7a3 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt @@ -1 +1 @@ - \ No newline at end of file +If Controller Attribute is set, use it for the controller name ([#1033](https://github.com/dotnet/aspnet-api-versioning/issues/1033)) \ No newline at end of file