zoukankan      html  css  js  c++  java
  • Visual Studio 2017 发布的项目在 Ubuntu 运行出错 *.deps.json was not found

    原文网址:https://blog.csdn.net/lihongzhai/article/details/79039160

    今天遇到了很奇怪的现象,在Windows上发布的asp.net core app部署到linux上就不好用了。提示如下错误:

        Error:
        An assembly specified in the application dependencies manifest (Calculate24Web.deps.json) was 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
    

    这个是我自己发布后在 Ubuntu 上运行时显示的错误

    Error:
    An assembly specified in the application dependencies manifest (..deps.json) was not found:
    package: 'Microsoft.AspNetCore.Antiforgery', version: '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

    把源码拷贝到Linux的机器上,可以编译,可以在开发模式下运行,(好像在Debug模式下还成功了),后来在Release模式下发布,就不能运行,提示上面的错误。

    经过一天的倒腾,终于,最后,是个小问题。问题是asp.net 没有把服务器需要的包全部发布出来,它认为是目标系统带着有,而实际上目标系统中没有。

    解决办法:

    增加如下一行到 csjproj文件中即可:

    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
    

    最后csjproj文件看上去像这个样子:

    <Project Sdk="Microsoft.NET.Sdk.Web">
      <PropertyGroup>
        <TargetFramework>netcoreapp2.0</TargetFramework>
        <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
      </PropertyGroup>
    
  • 相关阅读:
    CentOS 6.5 编译安装Apache2.4
    Linux 服务器安全优化
    yum安装Apache2.4
    HDU 3308 线段树求区间最长连续上升子序列长度
    HDU 3607 线段树+DP+离散化
    POJ 3667 线段树区间合并裸题
    HDU 5726 线段树+dp
    牛客网多校训练第二场D Kth Minimum Clique
    HDU 4325 离散化+树状数组 或者 不使用树状数组
    HDU 2167 状压dp方格取数
  • 原文地址:https://www.cnblogs.com/mahidol/p/9064943.html
Copyright © 2011-2022 走看看