Skip to content

Commit 3020087

Browse files
author
William Li
committed
Address code review
1 parent a0370c5 commit 3020087

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateAssemblyInfo.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Copyright (c) .NET Foundation. All rights reserved.
118118

119119
<ItemGroup Condition="'$(TargetPlatformIdentifier)' != '' and '$(MinimumOSPlatform)' != ''">
120120
<AssemblyAttribute Include="System.Runtime.Versioning.MinimumOSPlatformAttribute">
121-
<_Parameter1>$(TargetPlatformIdentifier.ToLower())$(MinimumOSPlatform)</_Parameter1>
121+
<_Parameter1>$(TargetPlatformIdentifier)$(MinimumOSPlatform)</_Parameter1>
122122
</AssemblyAttribute>
123123
</ItemGroup>
124124
</Target>

src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSMinimumVersion.cs

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using FluentAssertions;
1010
using Xunit.Abstractions;
1111
using Microsoft.NET.TestFramework.ProjectConstruction;
12-
using System.Runtime.Versioning;
1312

1413
namespace Microsoft.NET.Build.Tests
1514
{
@@ -40,14 +39,15 @@ public void WhenPropertiesAreSetItCanGenerateMinimumOSPlatformAttribute()
4039
var targetPlatformIdentifier = "iOS";
4140
testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
4241
testProject.AdditionalProperties["MinimumOSPlatform"] = "13.2";
42+
testProject.AdditionalProperties["TargetPlatformVersion"] = "14.0";
4343

4444
var testAsset = _testAssetsManager.CreateTestProject(testProject);
4545

4646
var runCommand = new DotnetCommand(Log, "run");
4747
runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
4848
runCommand.Execute()
4949
.Should()
50-
.Pass().And.HaveStdOutContaining("PlatformName:ios13.2");
50+
.Pass().And.HaveStdOutContaining("PlatformName:iOS13.2");
5151
}
5252

5353
[Fact]
@@ -65,7 +65,7 @@ public void WhenMinimumOSPlatformISNotSetTargetPlatformVersionIsSetItCanGenerate
6565
runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
6666
runCommand.Execute()
6767
.Should()
68-
.Pass().And.HaveStdOutContaining("PlatformName:ios13.2");
68+
.Pass().And.HaveStdOutContaining("PlatformName:iOS13.2");
6969
}
7070

7171
private static TestProject SetUpProject()
@@ -79,7 +79,6 @@ private static TestProject SetUpProject()
7979
};
8080

8181
testProject.SourceFiles["PrintAttribute.cs"] = _printAttribute;
82-
testProject.SourceFiles[$"AttributeIsNotDefinedYetWorkaround.cs"] = _attributeIsNotDefinedYetWorkaround;
8382
return testProject;
8483
}
8584

@@ -109,34 +108,5 @@ public static void Main()
109108
}
110109
";
111110

112-
private static readonly string _attributeIsNotDefinedYetWorkaround = @"
113-
namespace System.Runtime.Versioning
114-
{
115-
[AttributeUsage(AttributeTargets.Assembly |
116-
AttributeTargets.Class |
117-
AttributeTargets.Constructor |
118-
AttributeTargets.Event |
119-
AttributeTargets.Method |
120-
AttributeTargets.Module |
121-
AttributeTargets.Property |
122-
AttributeTargets.Struct,
123-
AllowMultiple = true, Inherited = false)]
124-
public sealed class MinimumOSPlatformAttribute : OSPlatformAttribute
125-
{
126-
public MinimumOSPlatformAttribute(string platformName) : base(platformName)
127-
{
128-
}
129-
}
130-
131-
public abstract class OSPlatformAttribute : Attribute
132-
{
133-
private protected OSPlatformAttribute(string platformName)
134-
{
135-
PlatformName = platformName;
136-
}
137-
public string PlatformName { get; }
138-
}
139-
}";
140-
141111
}
142112
}

0 commit comments

Comments
 (0)