-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Prevent built-in artifacts output functionality from conflicting with Microsoft.Build.Artifacts SDK #33470
Merged
Merged
Prevent built-in artifacts output functionality from conflicting with Microsoft.Build.Artifacts SDK #33470
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
28 changes: 28 additions & 0 deletions
28
src/Assets/TestProjects/ArtifactsSdkTest/ArtifactsSdkTest.sln
This file contains 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,28 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageReference", "PackageReference\PackageReference.csproj", "{78885455-FD34-4D8A-BB3D-D5DDB1AA2A4F}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildSdk", "MSBuildSdk\MSBuildSdk.csproj", "{6BFF7261-0DFB-4C37-954F-DBD11213FDEF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{78885455-FD34-4D8A-BB3D-D5DDB1AA2A4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{78885455-FD34-4D8A-BB3D-D5DDB1AA2A4F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{78885455-FD34-4D8A-BB3D-D5DDB1AA2A4F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{78885455-FD34-4D8A-BB3D-D5DDB1AA2A4F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6BFF7261-0DFB-4C37-954F-DBD11213FDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6BFF7261-0DFB-4C37-954F-DBD11213FDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6BFF7261-0DFB-4C37-954F-DBD11213FDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6BFF7261-0DFB-4C37-954F-DBD11213FDEF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
5 changes: 5 additions & 0 deletions
5
src/Assets/TestProjects/ArtifactsSdkTest/Directory.Build.props
This file contains 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,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<BaseArtifactsPath>$(MSBuildThisFileDirectory)artifacts</BaseArtifactsPath> | ||
</PropertyGroup> | ||
</Project> |
6 changes: 6 additions & 0 deletions
6
src/Assets/TestProjects/ArtifactsSdkTest/MSBuildSdk/Class1.cs
This file contains 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,6 @@ | ||
namespace MSBuildSdk; | ||
|
||
public class Class1 | ||
{ | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/Assets/TestProjects/ArtifactsSdkTest/MSBuildSdk/MSBuildSdk.csproj
This file contains 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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Sdk Name="Microsoft.Build.Artifacts"/> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(CurrentTargetFramework)</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<ArtifactsPath>$(BaseArtifactsPath)\$(MSBuildProjectName)</ArtifactsPath> | ||
</PropertyGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
src/Assets/TestProjects/ArtifactsSdkTest/PackageReference/PackageReference.csproj
This file contains 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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>$(CurrentTargetFramework)</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<ArtifactsPath>$(BaseArtifactsPath)\$(MSBuildProjectName)</ArtifactsPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build.Artifacts" Version="4.2.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
2 changes: 2 additions & 0 deletions
2
src/Assets/TestProjects/ArtifactsSdkTest/PackageReference/Program.cs
This file contains 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,2 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); |
This file contains 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,5 @@ | ||
{ | ||
"msbuild-sdks": { | ||
"Microsoft.Build.Artifacts": "4.2.0" | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user references Microsoft.Build.Artifacts as a package, its
.props
is imported by.nuget.g.props
which is imported after this. So I don't thinkUsingMicrosoftArtifactsSdk
will be set yet since this is imported immediately afterDirectory.Build.props
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only imported early on if
UseArtifactsOutput
orArtifactsPath
are set in Directory.Build.props:sdk/src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.props
Lines 64 to 65 in 9d157dc
If they are set later on (ie in the project file), then this file will be imported later, during the .targets evaluation: https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultOutputPaths.targets#L42-L43
So if the Microsoft.Build.Artifacts NuGet package is being used and
ArtifactsPath
is set in Directory.Build.props, then the built-in SDK artifacts functionality will be used. IfArtifactsPath
is set in the project file (as seems to be suggested in the Microsoft.Build.Artifacts documentation), then the Microsoft.Build.Artifacts logic will be used.Does this sound OK? Do you know if anyone using Microsoft.Build.Artifacts is setting
ArtifactsPath
in Directory.Build.props? IE, something like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffkl I went ahead and merged this because we wanted to get the fix in before the .NET 8 Preview 6 branch, Let me know what you think about this and we can follow up with another change if need be.