Search code examples
.netvisual-studiodeploymentcommand-line-interfacepublish

.NET publish CLI command not updating "publish" folder


I have a web API in .NET and i have always published this application in Visual Studio Publish Tool (My Visual Studio is in Portuguese). enter image description here

This is my publish profile:

<Project>
  <PropertyGroup>
    <DeleteExistingFiles>false</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>bin\Release\net7.0\publish\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
    <SiteUrlToLaunchAfterPublish />
    <TargetFramework>net7.0</TargetFramework>
    <RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
    <PublishSingleFile>true</PublishSingleFile>
    <ProjectGuid>acd5c81a-d250-42a9-acc0-9e929b78dfa3</ProjectGuid>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
</Project>

My problem is that im trying to publish the project by CLI now, and i have tried these two commands:

dotnet publish --configuration Release --runtime linux-arm64 --self-contained true dotnet publish -p:PublishProfile=FolderProfile

Apparently both work, but when i deploy using the Visual Studio Publish tool, my folder "publish" updates, but when i run any of these two commands, the "publish" folder dont update. I need a command with the same configuration of my publish profile that update my "publish" folder properly.


Solution

  • The command you are looking for is:

    dotnet publish --configuration Release --runtime linux-arm64 --self-contained true --output C:\YOUR\PUBLISH\FOLDER