Skip to content

Commit af0dae7

Browse files
authored
[automated] Merge branch 'release/9.0.2xx' => 'release/9.0.3xx' (#48118)
2 parents 5026d90 + cbc5917 commit af0dae7

File tree

10 files changed

+58
-15
lines changed

10 files changed

+58
-15
lines changed

src/Cli/dotnet/commands/dotnet-sln/add/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ private void AddProject(SolutionModel solution, string solutionRelativeProjectPa
136136
{
137137
// Open project instance to see if it is a valid project
138138
ProjectRootElement projectRootElement = ProjectRootElement.Open(fullPath);
139+
ProjectInstance projectInstance = new ProjectInstance(projectRootElement);
139140
SolutionProjectModel project;
140141
try
141142
{
142143
project = solution.AddProject(solutionRelativeProjectPath, null, solutionFolder);
143144
}
144-
catch (SolutionArgumentException ex) when (ex.ParamName == "projectTypeName")
145+
catch (SolutionArgumentException ex) when (ex.Type == SolutionErrorType.InvalidProjectTypeReference)
145146
{
146147
// If guid is not identified by vs-solutionpersistence, check in project element itself
147-
var guid = projectRootElement.GetProjectTypeGuid();
148+
var guid = projectRootElement.GetProjectTypeGuid() ?? projectInstance.GetDefaultProjectTypeGuid();
148149
if (string.IsNullOrEmpty(guid))
149150
{
150151
Reporter.Error.WriteLine(CommonLocalizableStrings.UnsupportedProjectType, fullPath);
@@ -153,7 +154,6 @@ private void AddProject(SolutionModel solution, string solutionRelativeProjectPa
153154
project = solution.AddProject(solutionRelativeProjectPath, guid, solutionFolder);
154155
}
155156
// Add settings based on existing project instance
156-
ProjectInstance projectInstance = new ProjectInstance(projectRootElement);
157157
string projectInstanceId = projectInstance.GetProjectId();
158158
if (!string.IsNullOrEmpty(projectInstanceId) && serializer is ISolutionSerializer<SlnV12SerializerSettings>)
159159
{

src/SourceBuild/content/eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<ProductDependencies>
33
</ProductDependencies>
44
<ToolsetDependencies>
5-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25065.2">
5+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25077.4">
66
<Uri>https://github.com/dotnet/arcade</Uri>
7-
<Sha>c4bbc67763bf0c5a868862df874079380e647d61</Sha>
7+
<Sha>bac7e1caea791275b7c3ccb4cb75fd6a04a26618</Sha>
88
</Dependency>
99
</ToolsetDependencies>
1010
</Dependencies>

src/SourceBuild/content/eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
of a .NET major or minor release, prebuilts may be needed. When the release is mature, prebuilts
2424
are not necessary, and this property is removed from the file.
2525
-->
26-
<PrivateSourceBuiltSdkVersion>9.0.103</PrivateSourceBuiltSdkVersion>
27-
<PrivateSourceBuiltArtifactsVersion>9.0.103-servicing.25071.1</PrivateSourceBuiltArtifactsVersion>
26+
<PrivateSourceBuiltSdkVersion>9.0.104</PrivateSourceBuiltSdkVersion>
27+
<PrivateSourceBuiltArtifactsVersion>9.0.104-servicing.25113.1</PrivateSourceBuiltArtifactsVersion>
2828
<!-- command-line-api dependencies -->
2929
<SystemCommandLineVersion>2.0.0-beta4.24126.1</SystemCommandLineVersion>
3030
<!-- msbuild dependencies -->

src/SourceBuild/content/global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"tools": {
3-
"dotnet": "9.0.103"
3+
"dotnet": "9.0.104"
44
},
55
"msbuild-sdks": {
66
"Microsoft.Build.NoTargets": "3.7.0",
77
"Microsoft.Build.Traversal": "3.4.0",
8-
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25065.2"
8+
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25077.4"
99
}
1010
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Copyright (c) .NET Foundation. All rights reserved.
3232
<_FirstTargetFrameworkVersionToSupportSingleFileAnalyzer>$([MSBuild]::GetTargetFrameworkVersion('$(_FirstTargetFrameworkToSupportSingleFile)'))</_FirstTargetFrameworkVersionToSupportSingleFileAnalyzer>
3333
</PropertyGroup>
3434

35+
<ItemGroup>
36+
<ProjectCapability Condition="'$(IsAotCompatible)' == 'true'" Include="IsAotCompatible" />
37+
<ProjectCapability Condition="'$(IsTrimmable)' == 'true'" Include="IsTrimmable" />
38+
<ProjectCapability Condition="'$(PublishAot)' == 'true'" Include="PublishAot" />
39+
<ProjectCapability Condition="'$(PublishReadyToRun)' == 'true'" Include="PublishReadyToRun" />
40+
<ProjectCapability Condition="'$(PublishSingleFile)' == 'true'" Include="PublishSingleFile" />
41+
<ProjectCapability Condition="'$(PublishTrimmed)' == 'true'" Include="PublishTrimmed" />
42+
</ItemGroup>
43+
3544
<ItemDefinitionGroup>
3645
<ResolvedFileToPublish>
3746
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<Solution />
1+
<Solution />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26006.2
5+
MinimumVisualStudioVersion = 10.0.40219.1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Solution />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<DefaultProjectTypeGuid>{2F08BC15-189B-4804-B644-653F34C968A8}</DefaultProjectTypeGuid>
5+
</PropertyGroup>
6+
7+
</Project>

test/dotnet-sln.Tests/GivenDotnetSlnAdd.cs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static class ProjectTypeGuids
1818
public const string VBProjectTypeGuid = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
1919
public const string SolutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
2020
public const string SharedProjectGuid = "{D954291E-2A0B-460D-934E-DC6B0785DB48}";
21+
public const string DefaultProjectGuid = "{130159A9-F047-44B3-88CF-0CF7F02ED50F}";
2122
}
2223

2324
public class GivenDotnetSlnAdd : SdkTest
@@ -749,13 +750,13 @@ public void WhenPassedAnUnknownProjectTypeItFails(string solutionCommand)
749750
[InlineData("sln", "SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
750751
[InlineData("sln", "SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", ProjectTypeGuids.FSharpProjectTypeGuid)]
751752
[InlineData("sln", "SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", ProjectTypeGuids.VBProjectTypeGuid)]
752-
[InlineData("sln", "SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
753-
[InlineData("sln", "SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
753+
[InlineData("sln", "SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", ProjectTypeGuids.DefaultProjectGuid)]
754+
[InlineData("sln", "SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", ProjectTypeGuids.DefaultProjectGuid)]
754755
[InlineData("solution", "SlnFileWithNoProjectReferencesAndCSharpProject", "CSharpProject", "CSharpProject.csproj", ProjectTypeGuids.CSharpProjectTypeGuid)]
755756
[InlineData("solution", "SlnFileWithNoProjectReferencesAndFSharpProject", "FSharpProject", "FSharpProject.fsproj", ProjectTypeGuids.FSharpProjectTypeGuid)]
756757
[InlineData("solution", "SlnFileWithNoProjectReferencesAndVBProject", "VBProject", "VBProject.vbproj", ProjectTypeGuids.VBProjectTypeGuid)]
757-
[InlineData("solution", "SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
758-
[InlineData("solution", "SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", "{130159A9-F047-44B3-88CF-0CF7F02ED50F}")]
758+
[InlineData("solution", "SlnFileWithNoProjectReferencesAndUnknownProjectWithSingleProjectTypeGuid", "UnknownProject", "UnknownProject.unknownproj", ProjectTypeGuids.DefaultProjectGuid)]
759+
[InlineData("solution", "SlnFileWithNoProjectReferencesAndUnknownProjectWithMultipleProjectTypeGuids", "UnknownProject", "UnknownProject.unknownproj", ProjectTypeGuids.DefaultProjectGuid)]
759760
public async Task WhenPassedAProjectItAddsCorrectProjectTypeGuid(
760761
string solutionCommand,
761762
string testAsset,
@@ -788,7 +789,7 @@ public async Task WhenPassedAProjectItAddsCorrectProjectTypeGuid(
788789
[InlineData("solution", ".sln")]
789790
[InlineData("sln", ".slnx")]
790791
[InlineData("solution", ".slnx")]
791-
public void WhenPassedAProjectWithoutATypeGuidItErrors(string solutionCommand, string solutionExtension)
792+
public void WhenPassedAProjectWithoutATypeGuidNorDefaultTypeGuidItErrors(string solutionCommand, string solutionExtension)
792793
{
793794
var solutionDirectory = _testAssetsManager
794795
.CopyTestAsset("SlnFileWithNoProjectReferencesAndUnknownProjectType", identifier: $"GivenDotnetSlnAdd-{solutionCommand}{solutionExtension}")
@@ -814,6 +815,26 @@ public void WhenPassedAProjectWithoutATypeGuidItErrors(string solutionCommand, s
814815
.BeVisuallyEquivalentTo(contentBefore);
815816
}
816817

818+
[Theory]
819+
[InlineData("sln", ".sln")]
820+
[InlineData("solution", ".sln")]
821+
[InlineData("sln", ".slnx")]
822+
[InlineData("solution", ".slnx")]
823+
public void WhenPassedAProjectWithDefaultProjectGuidItPasses(string solutionCommand, string solutionExtension)
824+
{
825+
var solutionDirectory = _testAssetsManager
826+
.CopyTestAsset("TestAppWithSlnAndDefaultProjectType", identifier: $"GivenDotnetSlnAdd-{solutionCommand}{solutionExtension}")
827+
.WithSource()
828+
.Path;
829+
830+
var cmd = new DotnetCommand(Log)
831+
.WithWorkingDirectory(solutionDirectory)
832+
.Execute(solutionCommand, $"App{solutionExtension}", "add", "Unknown.unknownproj");
833+
834+
cmd.Should().Pass();
835+
cmd.StdErr.Should().BeEmpty();
836+
}
837+
817838
[Theory]
818839
[InlineData("sln", ".sln")]
819840
[InlineData("solution", ".sln")]

0 commit comments

Comments
 (0)