question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet publish not using PublishProfile

See original GitHub issue

According to the documentation I can run the following command from my project folder using the same publish profile as produced in Visual Studio 2017.

dotnet publish -p:PublishProfile=FolderProfile

This is my FolderProfile.pubxml for a console application with target framework .NET Core 2.1

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<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>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
    <_IsPortable>false</_IsPortable>
  </PropertyGroup>
</Project>

When executing dotnet publish -p:PublishProfile=FolderProfile the FolderProfile.pubxml is ignored and I see this output

dotnet publish -p:PublishProfile=FolderProfile Microsoft ® Build Engine version 15.9.20+g88f5fadfbe for .NET Core Copyright © Microsoft Corporation. All rights reserved.

Restore completed in 39.74 ms for C:\Users\mheptinstall\source\repos\DataWarehouse\CSDS\CSDS.CreateCsdsXml\CSDS.CreateCsdsXml.csproj. CSDS.CreateCsdsXml -> C:\Users\mheptinstall\source\repos\DataWarehouse\CSDS\CSDS.CreateCsdsXml\bin\Debug\netcoreapp2.1\CreateCsdsXml.dll CSDS.CreateCsdsXml -> C:\Users\mheptinstall\source\repos\DataWarehouse\CSDS\CSDS.CreateCsdsXml\bin\Debug\netcoreapp2.1\publish\

dotnet --info output:

.NET Core SDK (reflecting any global.json): Version: 2.2.110 Commit: 4797dabd3c

Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.110\

Host (useful for support): Version: 3.1.4 Commit: 0c2e69caa6

.NET Core SDKs installed: 2.1.514 [C:\Program Files\dotnet\sdk] 2.1.516 [C:\Program Files\dotnet\sdk] 2.2.110 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

dotnet publish -p:PublishProfile=FolderProfile output: msbuild.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
fugledecommented, Mar 19, 2021

I also just ran into this issue (tested with .NET SDK 5.0.104 and 5.0.201). Neither PublishProfile or PublishProfileFullPath is able to pick up a FolderProfile.pubxml located in Properties\PublishProfiles, and generated by VS 2019.

1reaction
adegeocommented, Sep 8, 2021

@fuglede @mrlife This issue is closed, you should open up a new issue to get the proper eyes on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - dotnet publish with /p:PublishProfile
Workaround I use for now is to manually edit *.pubxml file produced by VS.Net to have both PublishUrl and PublishDir keys with the...
Read more >
Visual Studio publish profiles (.pubxml) for ASP.NET Core ...
To deploy the app using a publish profile, execute the msbuild command from a Visual Studio Developer Command Prompt. The command prompt is ......
Read more >
dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >
Visual Studio publish profiles for ASP.NET Core app deployment
To publish with a non-folder profile, call MSBuild directly. The following folder publish profile was created with Visual Studio and publishes to a...
Read more >
Publishing multiple .NET Core applications in a single ...
Using the “Publish” functionality within Visual Studio 2019 to create the publication folders for each of the projects works perfectly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found