Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal sealed class VirtualProjectBuildingCommand : CommandBase
new("ImplicitUsings", "enable"),
new("Nullable", "enable"),
new("PublishAot", "true"),
new("PackAsTool", "true"),
]);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ public void SameAsTemplate()
var dotnetProjectConvertProjectText = File.ReadAllText(dotnetProjectConvertProject);
var dotnetNewConsoleProjectText = File.ReadAllText(dotnetNewConsoleProject);

// There are some differences: we add PublishAot=true and UserSecretsId.
// There are some differences: we add PublishAot=true, PackAsTool=true, and UserSecretsId.
var patchedDotnetProjectConvertProjectText = dotnetProjectConvertProjectText
.Replace(" <PublishAot>true</PublishAot>" + Environment.NewLine, string.Empty);
.Replace("""
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>

""", string.Empty);
patchedDotnetProjectConvertProjectText = Regex.Replace(patchedDotnetProjectConvertProjectText,
""" <UserSecretsId>[^<]*<\/UserSecretsId>""" + Environment.NewLine, string.Empty);

Expand Down Expand Up @@ -661,6 +665,7 @@ public void ProcessingSucceeds()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<UserSecretsId>Program-*</UserSecretsId>
</PropertyGroup>

Expand Down Expand Up @@ -708,6 +713,7 @@ public void UserSecretsId_Overridden_ViaDirective(bool hasDirectiveBuildProps)
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<UserSecretsId>MyIdFromDirective</UserSecretsId>
</PropertyGroup>

Expand Down Expand Up @@ -747,6 +753,7 @@ public void UserSecretsId_Overridden_ViaDirectoryBuildProps()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
</PropertyGroup>

</Project>
Expand Down Expand Up @@ -791,6 +798,7 @@ public void UserSecretsId_Overridden_SameAsImplicit(bool hasDirective, bool hasD
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<UserSecretsId>{(hasDirective ? SecurityElement.Escape(implicitValue) : "Program-*")}</UserSecretsId>
</PropertyGroup>

Expand Down Expand Up @@ -822,6 +830,7 @@ public void Directives()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<TargetFramework>net472</TargetFramework>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand Down Expand Up @@ -852,6 +861,7 @@ public void Directives_AllDefaultOverridden()
#:property TargetFramework=net472
#:property Nullable=disable
#:property PublishAot=false
#:property PackAsTool=false
#:property Custom=1
#:property ImplicitUsings=disable
Console.WriteLine();
Expand All @@ -864,6 +874,7 @@ public void Directives_AllDefaultOverridden()
<TargetFramework>net472</TargetFramework>
<Nullable>disable</Nullable>
<PublishAot>false</PublishAot>
<PackAsTool>false</PackAsTool>
<Custom>1</Custom>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>
Expand Down Expand Up @@ -893,6 +904,7 @@ public void Directives_Variable()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<MyProp>MyValue</MyProp>
</PropertyGroup>

Expand Down Expand Up @@ -930,6 +942,7 @@ public void Directives_DirectoryPath()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -968,6 +981,7 @@ public void Directives_Separators()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Prop1>One=a/b</Prop1>
<Prop2>Two/a=b</Prop2>
</PropertyGroup>
Expand Down Expand Up @@ -1077,6 +1091,7 @@ public void Directives_Escaping()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Prop>&lt;test&quot;&gt;</Prop>
</PropertyGroup>

Expand Down Expand Up @@ -1111,6 +1126,7 @@ public void Directives_Whitespace()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Name>Value</Name>
<NugetPackageDescription>&quot;My package with spaces&quot;</NugetPackageDescription>
</PropertyGroup>
Expand All @@ -1137,6 +1153,7 @@ public void Directives_BlankLines()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -1202,6 +1219,7 @@ public void Directives_AfterToken()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Prop1>1</Prop1>
<Prop2>2</Prop2>
</PropertyGroup>
Expand Down Expand Up @@ -1248,6 +1266,7 @@ public void Directives_AfterIf()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Prop1>1</Prop1>
<Prop2>2</Prop2>
</PropertyGroup>
Expand Down Expand Up @@ -1291,6 +1310,7 @@ public void Directives_Comments()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<Prop1>1</Prop1>
<Prop2>2</Prop2>
</PropertyGroup>
Expand Down Expand Up @@ -1398,6 +1418,7 @@ public void Directives_VersionedSdkFirst()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
</PropertyGroup>

</Project>
Expand Down
5 changes: 3 additions & 2 deletions test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,6 @@ public void Pack()
var testInstance = _testAssetsManager.CreateTestDirectory();
var programFile = Path.Join(testInstance.Path, "MyFileBasedTool.cs");
File.WriteAllText(programFile, """
#:property PackAsTool=true
Console.WriteLine($"Hello; EntryPointFilePath set? {AppContext.GetData("EntryPointFilePath") is string}");
#if !DEBUG
Console.WriteLine("Release config");
Expand Down Expand Up @@ -1742,7 +1741,6 @@ public void Pack_CustomPath()
var testInstance = _testAssetsManager.CreateTestDirectory();
var programFile = Path.Join(testInstance.Path, "MyFileBasedTool.cs");
File.WriteAllText(programFile, """
#:property PackAsTool=true
#:property PackageOutputPath=custom
Console.WriteLine($"Hello; EntryPointFilePath set? {AppContext.GetData("EntryPointFilePath") is string}");
""");
Expand Down Expand Up @@ -3309,6 +3307,7 @@ public void Api()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<DisableDefaultItemsInProjectFolder>true</DisableDefaultItemsInProjectFolder>
<RestoreUseStaticGraphEvaluation>false</RestoreUseStaticGraphEvaluation>
Expand Down Expand Up @@ -3379,6 +3378,7 @@ public void Api_Diagnostic_01()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<DisableDefaultItemsInProjectFolder>true</DisableDefaultItemsInProjectFolder>
<RestoreUseStaticGraphEvaluation>false</RestoreUseStaticGraphEvaluation>
Expand Down Expand Up @@ -3446,6 +3446,7 @@ public void Api_Diagnostic_02()
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PackAsTool>true</PackAsTool>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<DisableDefaultItemsInProjectFolder>true</DisableDefaultItemsInProjectFolder>
<RestoreUseStaticGraphEvaluation>false</RestoreUseStaticGraphEvaluation>
Expand Down
Loading