dotnet发布配置文件将忽略pubxml文件

编程入门 行业动态 更新时间:2024-10-25 14:33:16
本文介绍了dotnet发布配置文件将忽略pubxml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下通过Visual Studio 2019创建的pubxml文件:

I have the following pubxml file which I created via Visual Studio 2019:

<Project ToolsVersion="4.0" xmlns="schemas.microsoft/developer/msbuild/2003"> <PropertyGroup> <WebPublishMethod>FileSystem</WebPublishMethod> <PublishProvider>FileSystem</PublishProvider> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedPlatform>Any CPU</LastUsedPlatform> <SiteUrlToLaunchAfterPublish /> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <ExcludeApp_Data>False</ExcludeApp_Data> <TargetFramework>netcoreapp3.1</TargetFramework> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <ProjectGuid>143a6329-27d9-474e-9521-835be634c293</ProjectGuid> <SelfContained>true</SelfContained> <publishUrl>bin\Release\netcoreapp3.1\publish\</publishUrl> <DeleteExistingFiles>True</DeleteExistingFiles> </PropertyGroup> </Project>

当我运行dotnet.exe publish src\MyProject.Web.sln -p:PublishProfile=Properties\PublishProfiles\ProductionPublish.pubxml时,发行版不包含任何内容,并且发布发生在Debug文件夹(调试版本)上.为什么会发生这种情况而忽略pubxml?

When I run dotnet.exe publish src\MyProject.Web.sln -p:PublishProfile=Properties\PublishProfiles\ProductionPublish.pubxml Release does not contain anything and publish happens on Debug folder (debug build). Whys does this happens and pubxml is ignored?

更新#1

Structure src\MyProject\MyProject.csproj src\MyProject.Utils\ect.Utils.csproj src\MyProject.Web\MyProject.Web.csproj src\MyProject.Web.sln

和pubxml的路径

src\MyProject.Web\Properties\PublishProfiles\ProductionPublish.pubxml

推荐答案

您需要使用以下命令:

dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile

  • 它是build,而不是publish.

    • It's build, not publish.

      即使我的FolderProfile的配置设置为Release,我也必须 包括-c Release,因为否则生成了依赖项目 具有调试配置.

      Even if my FolderProfile's configuration is set to Release, I had to include -c Release because otherwise dependent projects were built with debug configuration.

      如果不使用/p:DeployOnBuild=true进行调用,则文件不会复制到目标位置.

      Files not copied to target location if called without /p:DeployOnBuild=true.

      对于,只需名称FolderProfile-无扩展名-就足够了 配置文件.或者您可以给出路径 /p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml

      Just the name FolderProfile -without extension- is enough for the profile file. Or you can give the path /p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml

      请参见来自Microsoft文档的文件夹发布示例.

更多推荐

dotnet发布配置文件将忽略pubxml文件

本文发布于:2023-11-10 09:27:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575002.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:配置文件   文件   dotnet   pubxml

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!