ASP.Net核心发布一个空文件夹

时间:2018-02-08 18:50:07

标签: asp.net-core publishing

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

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

网页显示" DEBUG" ...

原始问题

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

创建个人资料=> Folder => 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的空文件夹。

1 个答案:

答案 0 :(得分:2)

这不能直接回答您的问题,但可以解决您的问题:发布时使用dotnet CLI,dotnet publish -c Release -o "path/to/output" 到.csproj目录或.sln,然后运行:

ax.legend(loc='center left', bbox_to_anchor=(1.0, 0.5))