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

Witt's Avatar


12 Jul, 2017 08:23 AM


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=, 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


    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!


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