Akli
Akli

Reputation: 1539

ASP.Net core publishes an empty folder

EDIT: I've noticed that there's a folder in bin\Debug\net461\Publish with everything required, I tried to check the configuration used this way :

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

The web page displays "DEBUG"...

Original question:

ASP.Net core publishes an empty folder : I don't have that problem with ASP.Net, only with ASP.Net Core. So here's how I create my publishing profile on both platforms :

Create profile => Folder => bin\Release\PublishOutput => Create Profile => Publish

With Asp.Net it generates this .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>

Output with 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 ==========

With Asp.Net Core it generates this .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>

Output with 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 ==========

I tried on 3 computers, I still get an empty folder with Asp.Net Core.

Upvotes: 3

Views: 1984

Answers (1)

mausworks
mausworks

Reputation: 1625

This doesn't answer your question directly, but solves your problem: use the dotnet CLI when publishing, cd to the directory of your .csproj or .sln, then run:

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

Upvotes: 3

Related Questions