zoukankan      html  css  js  c++  java
  • NET core 添加了新的nuget包,部署出现Could not load file or assembly

    这个坑,今天整了一天,我添加了Microsoft.AspNetCore.Mvc.Versioning包,结果发布到服务器,我复制了dll过去出现了一直找不到加载不成功的问题

    Startup.ConfigureServices一直加载不成功,出错如下:

    Application startup exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. 系统找不到指定的文件。
    File name: 'Microsoft.AspNetCore.Mvc.Versioning, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
    at SC.API.Startup.ConfigureServices(IServiceCollection services)
    --- End of stack trace from previous location where exception was thrown ---
    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
    at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
    --- End of stack trace from previous location where exception was thrown ---
    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
    

    后面仔细发现,添加了新的nuget包,发布后,在发布地址的目录下 找到这个文件

    *.deps.json 此文件会新增nuget包的依赖关系,比较后发现

    解决方法:除业务DLL以外,还需要复制此json文件覆盖,使得项目可以加载nuget包,不然netcore 无法映射加载新的包

  • 相关阅读:
    mysql 模糊查询LIKE 在tp中使用
    json字符串与 js对象互相转换
    1431. Kids With the Greatest Number of Candies
    1481. Least Number of Unique Integers after K Removals
    560. Subarray Sum Equals K
    1476. Subrectangle Queries
    1475. Final Prices With a Special Discount in a Shop
    网速和流量有什么关系
    计算网速的计算公式是什么
    php file_put_contents 函数的使用
  • 原文地址:https://www.cnblogs.com/codedisco/p/12911946.html
Copyright © 2011-2022 走看看