Skip to content
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
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "8.0.100-alpha.1.23061.8",
"dotnet": "8.0.100-alpha.1.23067.5",
"runtimes": {
"dotnet": [
"$(VSRedistCommonNetCoreSharedFrameworkx6480PackageVersion)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ private void WriteETag(HttpContext context)
return string.Format(CultureInfo.InvariantCulture, "W/\"{0}{1}\"", EtagDiscriminator, Deltas[^1].SequenceId);
}

private void AppendDeltas(UpdateDelta[] updateDeltas)
private void AppendDeltas(UpdateDelta[]? updateDeltas)
{
if (updateDeltas.Length == 0)
if (updateDeltas == null || updateDeltas.Length == 0)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Intentionally pinned. This feature is supported in projects targeting 3.1 or newer.-->
<TargetFramework>netcoreapp3.1</TargetFramework>
<!-- Intentionally pinned. This feature is supported in projects targeting 6.0 or newer.-->
<TargetFramework>net6.0</TargetFramework>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>

<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Build.Tasks
/// and then update the stage 0 back.
///
/// Override NETCoreSdkVersion to stage 0 sdk version like 6.0.100-dev
///
///
/// Use a task to override since it was generated as a string literal replace anyway.
/// And using C# can have better error when anything goes wrong.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(ResolverTargetFramework);net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(ResolverTargetFramework);net472</TargetFrameworks>
<TargetFrameworks Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' ">$(ResolverTargetFramework)</TargetFrameworks>

<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/HelixTasks/HelixTasks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' ">netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
<TargetFrameworks Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' ">net6.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RootNamespace>Microsoft.DotNet.SDK.Build.Helix</RootNamespace>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,41 @@ public GivenThatWeWantToUseAnalyzers(ITestOutputHelper log) : base(log)
{
}

[Theory]
[InlineData("WebApp", false)]
[InlineData("WebApp", true)]
[InlineData("WebApp", null)]
public void It_resolves_requestdelegategenerator_correctly(string testAssetName, bool? isEnabled)
{
var asset = _testAssetsManager
.CopyTestAsset(testAssetName, identifier: isEnabled.ToString())
.WithSource()
.WithProjectChanges(project =>
{
if (isEnabled != null)
{
var ns = project.Root.Name.Namespace;
project.Root.Add(new XElement(ns + "PropertyGroup", new XElement("EnableRequestDelegateGenerator", isEnabled)));
}
});

var command = new GetValuesCommand(
Log,
asset.Path,
ToolsetInfo.CurrentTargetFramework,
"Analyzer",
GetValuesCommand.ValueType.Item);

command
.WithWorkingDirectory(asset.Path)
.Execute()
.Should().Pass();

var analyzers = command.GetValues();

Assert.Equal(isEnabled ?? false, analyzers.Any(analyzer => analyzer.Contains("Microsoft.AspNetCore.Http.Generators.dll")));
}

[Theory]
[InlineData("C#", "AppWithLibrary")]
[InlineData("VB", "AppWithLibraryVB")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular
api
blazorserver
blazorserver-empty
blazorwasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular
api
blazorserver
blazorserver-empty
blazorwasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular
api
blazorserver
blazorserver-empty
blazorwasm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ These templates matched your input:

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ These templates matched your input:

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ These templates matched your input:

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- --------------------------------
ASP.NET Core API api [C#] Web/API
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC
ASP.NET Core Web API webapi [C#],F# Web/WebAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Template options:
-ssp, --susi-policy-id <susi-policy-id> The sign-in and sign-up policy ID for this project (use with IndividualB2C auth).
Type: string
Default: b2c_1_susi
-S, --SignedOutCallbackPath <SignedOutCallbackPath> The global signout callback (use with IndividualB2C auth).
-socp, --signed-out-callback-path <signed-out-callback-path> The global signout callback (use with IndividualB2C auth).
Type: string
Default: /signout/B2C_1_susi
-rp, --reset-password-policy-id <reset-password-policy-id> The reset password policy ID for this project (use with IndividualB2C auth).
Expand Down Expand Up @@ -68,11 +68,12 @@ Template options:
-uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified.
Type: bool
Default: false
-f, --framework <net6.0|net7.0> The target framework for the project.
-f, --framework <net6.0|net7.0|net8.0> The target framework for the project.
Type: choice
net8.0 Target net8.0
net7.0 Target net7.0
net6.0 Target net6.0
Default: net7.0
Default: net8.0
--no-restore If specified, skips the automatic restore of the project on create.
Type: bool
Default: false
Expand All @@ -88,6 +89,9 @@ Template options:
--use-program-main Whether to generate an explicit Program class and Main method instead of top-level statements.
Type: bool
Default: false
-S, --SignedOutCallbackPath <SignedOutCallbackPath> The global signout callback (use with IndividualB2C auth).
Type: string
Default: /signout/B2C_1_susi

To see help for other template languages (F#), use --language option:
dotnet new mvc -h --language F#
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ Template options:
-minimal, --use-minimal-apis Whether to use minimal APIs instead of controllers.
Type: bool
Default: false
-f, --framework <net6.0|net7.0> The target framework for the project.
-f, --framework <net6.0|net7.0|net8.0> The target framework for the project.
Type: choice
net8.0 Target net8.0
net7.0 Target net7.0
net6.0 Target net6.0
Default: net7.0
Default: net8.0
--no-restore If specified, skips the automatic restore of the project on create.
Type: bool
Default: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Template options:
-ssp, --susi-policy-id <susi-policy-id> The sign-in and sign-up policy ID for this project (use with IndividualB2C auth).
Type: string
Default: b2c_1_susi
-S, --SignedOutCallbackPath <SignedOutCallbackPath> The global signout callback (use with IndividualB2C auth).
-socp, --signed-out-callback-path <signed-out-callback-path> The global signout callback (use with IndividualB2C auth).
Type: string
Default: /signout/B2C_1_susi
-rp, --reset-password-policy-id <reset-password-policy-id> The reset password policy ID for this project (use with IndividualB2C auth).
Expand Down Expand Up @@ -72,11 +72,12 @@ Template options:
-uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified.
Type: bool
Default: false
-f, --framework <net6.0|net7.0> The target framework for the project.
-f, --framework <net6.0|net7.0|net8.0> The target framework for the project.
Type: choice
net8.0 Target net8.0
net7.0 Target net7.0
net6.0 Target net6.0
Default: net7.0
Default: net8.0
--called-api-url <called-api-url> URL of the API to call from the web app. This option only applies if --auth SingleOrg, --auth MultiOrg or --auth IndividualB2C is specified.
Type: string
Default: https://graph.microsoft.com/v1.0
Expand All @@ -88,4 +89,7 @@ Template options:
Default: user.read
--use-program-main Whether to generate an explicit Program class and Main method instead of top-level statements.
Type: bool
Default: false
Default: false
-S, --SignedOutCallbackPath <SignedOutCallbackPath> The global signout callback (use with IndividualB2C auth).
Type: string
Default: /signout/B2C_1_susi
9 changes: 5 additions & 4 deletions src/Tests/dotnet-new.Tests/WebProjectsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public WebProjectsTests(WebProjectsFixture fixture, ITestOutputHelper log) : bas
}

[Theory]
[InlineData("emptyweb_cs-latest", "web")]
[InlineData("mvc_cs-latest", "mvc")]
[InlineData("mvc_fs-latest", "mvc", "-lang", "F#")]
[InlineData("api_cs-latest", "webapi")]
// TODO: Reenable after https://github.com/dotnet/sdk/issues/30033 is fixed
// [InlineData("emptyweb_cs-latest", "web")]
// [InlineData("mvc_cs-latest", "mvc")]
// [InlineData("mvc_fs-latest", "mvc", "-lang", "F#")]
// [InlineData("api_cs-latest", "webapi")]
[InlineData("emptyweb_cs-60", "web", "-f", "net6.0")]
[InlineData("mvc_cs-60", "mvc", "-f", "net6.0")]
[InlineData("mvc_fs-60", "mvc", "-lang", "F#", "-f", "net6.0")]
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/xunit-runner/XUnitRunner.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<SDKCustomXUnitArguments Condition="'$(SDKCustomXUnitArguments)' == ''">-nocolor</SDKCustomXUnitArguments>

<TaskTargetFramework>netcoreapp3.1</TaskTargetFramework>
<TaskTargetFramework>net6.0</TaskTargetFramework>
<TaskTargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</TaskTargetFramework>

<SDKHelixCustomSdkTaskDll>$(ArtifactsDir)\bin\HelixTasks\$(Configuration)\$(TaskTargetFramework)\HelixTasks.dll</SDKHelixCustomSdkTaskDll>
Expand Down
13 changes: 13 additions & 0 deletions src/WebSdk/Web/Sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ Copyright (c) .NET Foundation. All rights reserved.
IsImplicitlyDefined="true" />
</ItemGroup>

<!-- The RequestDelegateGenerator is bundled into the Microsoft.AspNetCore.App ref pack.-->
<!-- We want this generator to be disabled by default so we remove it from the list of-->
<!-- analyzers here. Since this depends on the analyzer having already been added to the-->
<!-- `Analyzer` item group by previous tasks in the build, we must wrap this work in a-->
<!-- target that executes right before the compilation loop.-->
<Target Name="RemoveRequestDelegateGenerator" BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer
Remove="@(Analyzer->HasMetadata('FileName')->WithMetadataValue('FileName', 'Microsoft.AspNetCore.Http.Generators'))"
Condition="'$(Language)'=='C#' AND '$(EnableRequestDelegateGenerator)' != 'true'"/>
</ItemGroup>
</Target>

<ItemGroup Condition="'$(Language)' == 'C#' AND ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable')">
<Using Include="System.Net.Http.Json" />
<Using Include="Microsoft.AspNetCore.Builder" />
Expand Down