-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow Implicit RID Opt Out + Don't Infer RID for non EXE Type Projects #28628
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bcaed25
Don't infer rid on non exe project type
nagilson a80d6b5
Add opt out feature and tests
nagilson 10c3bc5
Update src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Runt…
nagilson 47c024b
Make it a win only fact
nagilson 0f654d6
Merge branch 'nagilson-exe-rids' of https://github.com/nagilson/sdk i…
nagilson fb14de3
make the test fail in the old scenario
nagilson d3ed325
Consider that TestProjects May be Exe Projects without Being Tagged a…
nagilson b256814
Remove opt out feature and put it into UCR
nagilson d1c8744
Fix tests. Only thing remaining is to improve test quality
nagilson a00b2cf
Fix whitespace
nagilson d3173a2
Fix tests
nagilson 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
8 changes: 8 additions & 0 deletions
8
src/Assets/TestProjects/AppWithLibrarySDKStyleThatPublishesSingleFile/Program.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,8 @@ | ||
namespace newc; | ||
|
||
static class Program | ||
{ | ||
static void Main() | ||
{ | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/Assets/TestProjects/AppWithLibrarySDKStyleThatPublishesSingleFile/lib/Class1.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,5 @@ | ||
namespace lib; | ||
public class Class1 | ||
{ | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/Assets/TestProjects/AppWithLibrarySDKStyleThatPublishesSingleFile/lib/lib.csproj
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,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
</PropertyGroup> | ||
|
||
</Project> |
17 changes: 17 additions & 0 deletions
17
src/Assets/TestProjects/AppWithLibrarySDKStyleThatPublishesSingleFile/newc.csproj
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,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net7.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="lib\lib.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
44 changes: 44 additions & 0 deletions
44
src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileLibrary.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,44 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.IO; | ||
using FluentAssertions; | ||
using Microsoft.NET.TestFramework; | ||
using Microsoft.NET.TestFramework.Assertions; | ||
using Microsoft.NET.TestFramework.Commands; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.NET.Publish.Tests | ||
{ | ||
public class GivenThatWeWantToPublishASingleFileLibrary : SdkTest | ||
{ | ||
public GivenThatWeWantToPublishASingleFileLibrary(ITestOutputHelper log) : base(log) | ||
{ | ||
} | ||
|
||
[WindowsOnlyFact] | ||
// Tests regression on https://github.com/dotnet/sdk/pull/28484 | ||
public void ItPublishesSuccessfullyWithRIDAndPublishSingleFileLibrary() | ||
{ | ||
var targetFramework = ToolsetInfo.CurrentTargetFramework; | ||
var testAsset = _testAssetsManager | ||
.CopyTestAsset("AppWithLibrarySDKStyleThatPublishesSingleFile") | ||
.WithTargetFramework(targetFramework) | ||
.WithSource(); | ||
|
||
var publishCommand = new PublishCommand(testAsset); | ||
publishCommand.Execute() | ||
.Should() | ||
.Pass(); | ||
|
||
// It would be better if we could somehow check the library binlog or something for a RID instead. | ||
nagilson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var exeFolder = publishCommand.GetOutputDirectory(targetFramework: targetFramework); | ||
// Parent: RID, then TFM, then Debug, then bin, then the test folder | ||
var ridlessLibraryDllPath = Path.Combine(exeFolder.Parent.Parent.Parent.Parent.FullName, "lib", "bin", "Debug", targetFramework, "lib.dll"); | ||
Assert.True(File.Exists(ridlessLibraryDllPath)); | ||
} | ||
|
||
} | ||
|
||
} |
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.