gpt4 book ai didi

asp.net-core - ASP.Net core发布一个空文件夹

转载 作者:行者123 更新时间:2023-12-04 16:06:18 31 4
gpt4 key购买 nike

编辑:我注意到 bin\Debug\net461\Publish 中有一个文件夹包含所有需要的内容,我尝试检查以这种方式使用的配置:

#if DEBUG
ViewData["Message"] = "DEBUG";
#else
ViewData["Message"] = "else";
#endif

网页显示“DEBUG”...

原始问题:

ASP.Net Core 发布了一个空文件夹:我对 ASP.Net 没有这个问题,只有 ASP.Net Core 有这个问题。所以这就是我在两个平台上创建我的发布配置文件的方法:

创建配置文件 => 文件夹 => bin\Release\PublishOutput => 创建配置文件 => 发布

使用 Asp.Net,它生成这个 .pubxml:

<?xml version="1.0" encoding="utf-8"?>
<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>
<publishUrl>bin\Release\PublishOutput</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>

用 Asp.Net 输出:

2>Web App was published successfully file:///Path/bin/Release/PublishOutput
2>
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

使用 Asp.Net Core 它生成这个 .pubxml :

<?xml version="1.0" encoding="utf-8"?>
<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>
<ProjectGuid>32b7ffef-9cf4-471a-ab1a-ec3c69d0dd13</ProjectGuid>
<publishUrl>bin\Release\PublishOutput</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>

使用 Asp.Net Core 的输出:

Web App was published successfully file:///Path/bin/Release/PublishOutput
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

我在 3 台电脑上试过,我仍然得到一个带有 Asp.Net Core 的空文件夹。

最佳答案

这并没有直接回答您的问题,而是解决了您的问题:发布时使用 dotnet CLI,cd 到您的 .csproj 或 .sln 的目录,然后运行:

dotnet publish -c Release -o "path/to/output"

关于asp.net-core - ASP.Net core发布一个空文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48692762/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com