Original website: 79039160
Today's strange phenomenon is that the ASP. NET Core app published on Windows is not a good place to deploy to Linux. The following error is indicated:
Error: Anwas not found: package: ‘Microsoft.AspNetCore.Antiforgery’, version: ‘2.0.1’ path: ‘lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll’ This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: aspnetcore-store-2.0.3.xml
This is the error I showed when I ran my own post on Ubuntu.
Error: Anwas not found: package‘Microsoft.AspNetCore.Antiforgery‘‘2.0.3‘ path‘lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll‘ This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: aspnetcore-store-2.0.8.xml
Copy the source code to the Linux machine, can compile, can be run in the development mode, (as if in debug mode is also successful), and later released in release mode, you can not run, prompt the above error.
After a day of Daoteng, finally, finally, is a small problem. The problem is that ASP. NET does not publish all the packages the server needs, it thinks the target system is with it, and actually does not have it in the target system.
Workaround:
Add the following line to the Csjproj file:
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
The final csjproj file looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup>
Visual Studio 2017 published projects in Ubuntu run error *.deps.json is not found