ASP.NET Core Web API targeting full framework can't run
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?
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
Support Staff 1 Posted by rune on 15 Jul, 2017 06:38 AM
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.jsonpackage (version10.0.3and9.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.jsonissue you may have to set theBuild Actionproperty on the file reference for that file toContent(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