-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Enlighten RequiresFramework35SP1Assembly task for multithreaded mode #13575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jankratochvilcz
merged 5 commits into
main
from
jankratochvilcz/multithreaded/requires-framework35sp1-assembly
Apr 21, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
40dd0fd
Enlighten RequiresFramework35SP1Assembly task for multithreaded mode
10eecc9
Address review feedback
74f2204
Minor refactor to reduce duplication
jankratochvilcz 37df318
Minor refactor
jankratochvilcz 627eb9a
Merge branch 'main' into jankratochvilcz/multithreaded/requires-frame…
jankratochvilcz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
170 changes: 170 additions & 0 deletions
170
src/Tasks.UnitTests/RequiresFramework35SP1Assembly_Tests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Collections.Generic; | ||
| using Microsoft.Build.Framework; | ||
| using Microsoft.Build.Tasks; | ||
| using Microsoft.Build.Utilities; | ||
| using Shouldly; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Build.UnitTests | ||
| { | ||
| public sealed class RequiresFramework35SP1Assembly_Tests | ||
| { | ||
| private readonly ITestOutputHelper _output; | ||
|
|
||
| public RequiresFramework35SP1Assembly_Tests(ITestOutputHelper output) | ||
| { | ||
| _output = output; | ||
| } | ||
|
|
||
| private RequiresFramework35SP1Assembly CreateTask() => | ||
| new() | ||
| { | ||
| BuildEngine = new MockEngine(_output), | ||
| }; | ||
|
|
||
| [Fact] | ||
| public void Defaults_UncheckedSigningTriggers() | ||
| { | ||
| // The task's default SigningManifests=false is itself an "unchecked signing" trigger, | ||
| // so the all-defaults case reports RequiresMinimumFramework35SP1=true. | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void SigningEnabled_NoOtherSignals_DoesNotTrigger() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeFalse(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ErrorReportUrl_Triggers() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| task.ErrorReportUrl = "https://example.com/errors"; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void CreateDesktopShortcut_OnNet35_Triggers() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| task.TargetFrameworkVersion = "v3.5"; | ||
| task.CreateDesktopShortcut = true; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void SuiteName_Triggers() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| task.SuiteName = "MyAppSuite"; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Theory] | ||
| [InlineData("ReferencedAssemblies")] | ||
| [InlineData("Assemblies")] | ||
| [InlineData("Files")] | ||
| [InlineData("DeploymentManifestEntryPoint")] | ||
| [InlineData("EntryPoint")] | ||
| public void IncludeHashFalse_OnAnyItemInput_Triggers(string inputName) | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| ITaskItem item = new TaskItem("some.dll", new Dictionary<string, string?> { { "IncludeHash", "false" } }); | ||
| AssignItemInput(task, inputName, item); | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
jankratochvilcz marked this conversation as resolved.
|
||
|
|
||
| [Fact] | ||
| public void CreateDesktopShortcut_OnNet20_DoesNotTrigger() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| task.TargetFrameworkVersion = "v2.0"; | ||
| task.CreateDesktopShortcut = true; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeFalse(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void CreateDesktopShortcut_BareVersionString_Works() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| task.TargetFrameworkVersion = "3.5"; | ||
| task.CreateDesktopShortcut = true; | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Sp1AssemblyIdentity_TriggersWithoutIncludeHash() | ||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| AssignItemInput(task, "Files", new TaskItem("System.Data.Entity")); | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Net35ClientSentinelIdentity_Triggers() | ||
|
jankratochvilcz marked this conversation as resolved.
|
||
| { | ||
| RequiresFramework35SP1Assembly task = CreateTask(); | ||
| task.SigningManifests = true; | ||
| AssignItemInput(task, "Assemblies", new TaskItem("Sentinel.v3.5Client")); | ||
|
|
||
| task.Execute().ShouldBeTrue(); | ||
| task.RequiresMinimumFramework35SP1.ShouldBeTrue(); | ||
| } | ||
|
|
||
| private static void AssignItemInput(RequiresFramework35SP1Assembly task, string inputName, ITaskItem item) | ||
| { | ||
| switch (inputName) | ||
| { | ||
| case "ReferencedAssemblies": | ||
| task.ReferencedAssemblies = [item]; | ||
| break; | ||
| case "Assemblies": | ||
| task.Assemblies = [item]; | ||
| break; | ||
| case "Files": | ||
| task.Files = [item]; | ||
| break; | ||
| case "DeploymentManifestEntryPoint": | ||
| task.DeploymentManifestEntryPoint = item; | ||
| break; | ||
| case "EntryPoint": | ||
| task.EntryPoint = item; | ||
| break; | ||
| default: | ||
| throw new System.ArgumentOutOfRangeException(nameof(inputName)); | ||
|
jankratochvilcz marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.