Skip to content
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

Add error for incorrect PublishSelfContained #46171

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion src/Tasks/Common/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,13 @@ You may need to build the project on another operating system or architecture, o
<value>NETSDK1224: ASP.NET Core framework assets are not supported for the target framework.</value>
<comment>{StrBegins="NETSDK1224: "}</comment>
</data>
<!-- The latest message added is NativeCompilationRequiresPublishing. Please update this value with each PR to catch parallel PRs both adding a new message -->
<data name="NativeCompilationRequiresPublishing" xml:space="preserve">
<value>NETSDK1225: Native compilation is not supported when invoking the Publish target directly. Try running dotnet publish.</value>
<comment>{StrBegins="NETSDK1225: "}</comment>
</data>
<!-- The latest message added is PublishSelfContainedRequiresPublishing. Please update this value with each PR to catch parallel PRs both adding a new message -->
<data name="PublishSelfContainedRequiresPublishing" xml:space="preserve">
<value>NETSDK1226: PublishSelfContained is not supported when invoking the Publish target directly. Try running dotnet publish, or set SelfContained to true.</value>
<comment>{StrBegins="NETSDK1226: "}</comment>
</data>
</root>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ Copyright (c) .NET Foundation. All rights reserved.
ResourceName="SolutionProjectConfigurationsConflict"
FormatArguments="PublishRelease;$(ProjectName)"/>

<NETSdkError Condition="'$(PublishSelfContained)' == 'true' and
'$(_IsPublishing)' != 'true' and
'$(SelfContained)' != 'true' and
'$(_TargetFrameworkVersionWithoutV)' >= '10.0'"
ResourceName="PublishSelfContainedRequiresPublishing" />

<NETSdkError Condition="'$(PublishAot)' == 'true' and
'$(_IsPublishing)' != 'true' and
'$(PublishAotUsingRuntimePack)' == 'true' and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public void No_runtime_files()
Name = "SingleFileTest",
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
IsExe = true,
SelfContained = "true"
};

var testAsset = _testAssetsManager.CreateTestProject(testProject);
Expand Down Expand Up @@ -325,6 +326,7 @@ public void It_supports_composite_r2r(bool extractAll)
Name = projName,
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
IsExe = true,
SelfContained = "true"
};

var testAsset = _testAssetsManager.CreateTestProject(testProject);
Expand Down Expand Up @@ -769,7 +771,8 @@ private TestProject CreateTestProjectWithAnalyzerWarnings(string targetFramework
{
Name = projectName,
TargetFrameworks = targetFramework,
IsExe = isExecutable
IsExe = isExecutable,
SelfContained = "true"
};

testProject.SourceFiles[$"{projectName}.cs"] = @"
Expand Down Expand Up @@ -850,6 +853,7 @@ public void It_can_disable_cetcompat(bool? cetCompat)
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
RuntimeIdentifier = rid,
IsExe = true,
SelfContained = "true"
};
if (cetCompat.HasValue)
{
Expand Down Expand Up @@ -981,6 +985,7 @@ public void It_does_not_compress_single_file_by_default()
Name = "SingleFileTest",
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
IsExe = true,
SelfContained = "true"
};

var testAsset = _testAssetsManager.CreateTestProject(testProject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public void ItPublishesSuccessfullyWithRIDAndPublishSingleFileLibrary()
TestProject testProject = new("MainProject")
{
TargetFrameworks = targetFramework,
IsExe = true
IsExe = true,
SelfContained = "true"
};
testProject.ReferencedProjects.Add(referencedProject);
testProject.RecordProperties("RuntimeIdentifier");
Expand Down
Loading
Loading