net core web app issue

cristiz1992's Avatar


05 Aug, 2018 06:28 PM


I've deployed a .NET Core Web application using netcoreapp2.0. I've added the PublishDir in csproj and also set DefaultTargets to Publish.
The build and publish works, but when inspecting the build package i see that the "dist" folder is missing. The csproj looks like this:

<AngularDistFiles Include="$(MSBuildProjectDirectory)\dist**." />
<Target Name="BuildClientAngular" AfterTargets="Publish" Condition="$(ConfigurationName) == Release">
<Message Text="Installing node_modules folder" Importance="high" /> <Exec Command="npm install --no-optional" /> <Message Text="Finished installing node_modules folder" Importance="high" />
<Message Text="Creating dist folder" Importance="high" /> <Exec Command="npm run build:prod" /> <Message Text="Finished creating dist folder" Importance="high" />
<Copy SourceFiles="@(AngularDistFiles)" DestinationFiles="@(AngularDistFiles->'$(PublishDir)dist\%(RecursiveDir)%(Filename)%(Extension)')" /> <Message Text="Copied dist folder to website" Importance="high" /> </Target>
Another problem is when accessing the site i get the following error:
An error occurred while starting the application.
.NET Core 4.6.26614.01 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452    |    Microsoft Windows 6.3.9600    |   Need help?


  1. Support Staff 1 Posted by rune on 07 Aug, 2018 04:35 PM

    rune's Avatar


    I think you might be able to create the dist folder in the expected location by using a different MsBuild macro similar to to my response in this discussion -- so instead of

    <Copy SourceFiles="@(AngularDistFiles)" DestinationFiles="@(AngularDistFiles->'$(PublishDir)dist\%(RecursiveDir)%(Filename)%(Extension)')" />

    You can try and use:

    <Copy SourceFiles="@(AngularDistFiles)" DestinationFiles="@(AngularDistFiles->'$(WebProjectOutputDir)\dist\%(RecursiveDir)%(Filename)%(Extension)')" />

    I think this would put the dist folder in the web project output directory, but happy to take a closer look if that doesn't work. If so, I just need to know what application this is related to?


Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac