-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Area-CLIPublishVsBuildcli-uxIssues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)
Milestone
Description
Description
Running dotnet publish -p:PublishProfile=Anything.pubxml ignores the fact that the TargetFramework is specified within given .pubxml file and informs you (displays error) that you must specify the framework manually.
Current behavior
Error is displayed and publish process is stopped
The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, please specify the framework for the published application.
Expected behavior
TargetFramework should be retrieved from the .pubxml file.
Steps to reproduce
dotnet new console.- In
.csprojsetTargetFrameworkstonetcoreapp2.1;netcoreapp3.1.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<RootNamespace>dotnet_publish_issue</RootNamespace>
</PropertyGroup>
</Project>- Open up with VS, create any folder publish profile for
netcoreapp2.1. Created profile should look like this
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp2.1</TargetFramework>
<PublishDir>bin\Release\netcoreapp2.1\publish\</PublishDir>
</PropertyGroup>
</Project>- Executing
dotnet publish -p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxmlresults in error:
C:\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.CrossTargeting.targets(27,5): error : The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, please specify the framework for the published application. [C:\dotnet publish issue\dotnet publish issue.csproj]
Executing dotnet publish -p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml -f:netcoreapp2.1 works fine, but why does .pubxml's <TargetFramework> node is ignored?
MichelZ, PiemP, StevenRasmussen and gkarabin
Metadata
Metadata
Assignees
Labels
Area-CLIPublishVsBuildcli-uxIssues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)