【发布时间】:2020-10-28 10:18:00
【问题描述】:
我有以下通过 Visual Studio 2019 创建的 pubxml 文件:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/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 时,Release 不包含任何内容,并且发布发生在 Debug 文件夹(调试构建)上。为什么会发生这种情况并且 pubxml 被忽略?
更新 #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
【问题讨论】:
-
你有解决方案下的属性文件夹吗?还是在解决方案中的一个项目下?
-
更新了我的帖子请查收
-
您正在尝试发布解决方案。您应该从 MyProject.Web 文件夹运行
dotnet publish命令。这将发布您可以部署到 Web 服务器的 Web 应用程序。从 Web 项目文件夹运行时,您不需要将src\MyProject.Web.sln参数传递给dotnet publish命令。 -
我切换到你说的
dotnet.exe publish Radius.MicroServices.CySec.Web.csproj -p:PublishProfile=Properties\PublishProfiles\ProductionPublish.pubxml,结果还是一样
标签: c# asp.net .net .net-core msbuild