代码之家  ›  专栏  ›  技术社区  ›  Akli

ASP。Net core发布空文件夹

  •  3
  • Akli  · 技术社区  · 7 年前

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

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

    网页显示“调试”。。。

    原始问题 :

    ASP。Net core发布了一个空文件夹:我在ASP中没有这个问题。Net,仅使用ASP。净核心。下面是我如何在两种平台上创建我的发布配置文件:

    创建配置文件=>文件夹=>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输出。净值:

    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输出。净核心:

    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文件夹。净核心。

    1 回复  |  直到 7 年前
        1
  •  2
  •   mausworks    7 年前

    这并不能直接回答您的问题,但可以解决您的问题:发布时使用dotnet CLI, cd 到您的目录。csproj或。sln,然后运行:

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