ASP.NET Core Web API targeting full framework can't run

Witt's Avatar

Witt

12 Jul, 2017 08:23 AM

Hi,

I have an ASP.NET Core Web API targeting full framework (.Net 4.7). Locally through Visual Studio 2017 I can build and run without any problems. If I deploy the solution to AppHarbor (Both pushing through Bitbucket or deploying through AppHarbor CLI) or use msbuild MySolution.sln /p:Configuration=Release /property:OutDir=C:\temp
It can build without any problems, but I get the following exception when running it:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

If I deploy the output for the working Visual Studio build I get the following exception:
Unhandled Exception: System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The physical path is 'D:\Users\apphb50b8ca4d416282\app\appsettings.json'.

Anything I can do to make it work on AppHarbor?

  1. Support Staff 1 Posted by rune on 15 Jul, 2017 06:38 AM

    rune's Avatar

    Hi,

    I took a look at your build log for the currently deployed build and it seems the current issue is related to a NuGet package version mismatch with the newtonsoft.json package (version 10.0.3 and 9.0.1). Can you try and update your package references so all projects are using the same version? I think that'd solve the issue.

    With regards to the appsettings.json issue you may have to set the Build Action property on the file reference for that file to Content (in Visual Studio). This will cause the file is copied to the output directory when you build it on AppHarbor.

    I hope this helps!

    Best,
    Rune

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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