Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

net core web app issue

cristiz1992's Avatar

cristiz1992

05 Aug, 2018 06:28 PM

Hello,

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:

<ItemGroup>
<AngularDistFiles Include="$(MSBuildProjectDirectory)\dist**." />
</ItemGroup>
<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?

Thanks

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

    rune's Avatar

    Hi,

    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?

    Best,
    Rune

  2. 2 Posted by cristiz1992 on 23 Aug, 2018 02:09 PM

    cristiz1992's Avatar

    Hello,

    Regarding the dist folder, what you proposed worked.
    The second problem is related to the first one, it seems the application could not start without the dist folder being present.

    Thanks a lot for your help and sorry about the delay.

  3. cristiz1992 closed this discussion on 23 Aug, 2018 02:09 PM.

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

Keyboard shortcuts

Generic

? 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