ASP.NET Core: You must add a reference to assembly mscorlib, version=4.0.0.0

ASP.NET Core 引用外部程序包的时候,有时会出现下面的错误:

The type ‘Object‘ is defined in an assembly that is not referenced. You must add a reference to assembly ‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089‘. Sample.Infrastructure..NETStandard,Version=v1.6

解决方式:添加"Microsoft.NETCore.Portable.Compatibility": "1.0.0"引用。

{  "version": "1.0.0-*",  "dependencies": {    "NETStandard.Library": "1.6.0",    "Microsoft.NETCore.Portable.Compatibility": "1.0.0"  },  "frameworks": {    "netstandard1.6": {      "imports": [ "dnxcore50", "net451", "portable-net45+win81" ]    }  }}

参考资料:

时间: 2024-10-07 04:30:29

ASP.NET Core: You must add a reference to assembly mscorlib, version=4.0.0.0的相关文章

ASP.NET Core 共享第三方依赖库部署的Bug(*.deps.json on 2.2.0 or 4.6.0 版本)

背景: I try to put the Microsoft.*.dll and System.*.dll togather to a new folder.以便把(第三方或)系统的和应用的dll分开.之前花了很长的一段时间研究之后,最后:I find xxx.deps.json can make it work. 之后我还特意写了篇文章介绍它:https://www.cnblogs.com/cyq1162/p/10542832.html 今天遇Bug了: but today,when i up

ASP.NET Core 1.0中实现文件上传的两种方式(提交表单和采用AJAX)

Bipin Joshi (http://www.binaryintellect.net/articles/f1cee257-378a-42c1-9f2f-075a3aed1d98.aspx) Uploading files is a common requirement in web applications. In ASP.NET Core 1.0 uploading files and saving them on the server is quite easy. To that end

NLog在asp.net core中的应用

Asp.net core中,自带的Log是在当selfhost运行时,在控制台中输出,不便于查阅,如果用一个log架框,把日志持久化,便于查询. NLog是一个免费的日志记录框架,专门为.net平台下的框架提供日志功能,本文主要说明asp.net core下怎么使用NLog. 首先用Nuget安装NLog.Extensions.Logging和NLog.Web.AspNetCore两个类库. 修改project.json,在publishOptions中添加"nlog.config节点"

[转]An introduction to OAuth 2.0 using Facebook in ASP.NET Core

本文转自:http://andrewlock.net/an-introduction-to-oauth-2-using-facebook-in-asp-net-core/ This is the next post in a series on authentication and authorisation in ASP.NET Core. In this post I look in moderate depth at the OAuth 2.0 protocol as it pertain

一个Mini的ASP.NET Core框架的实现

原文:一个Mini的ASP.NET Core框架的实现 一.ASP.NET Core Mini 在2019年1月的微软技术(苏州)俱乐部成立大会上,蒋金楠老师(大内老A)分享了一个名为“ASP.NET Core框架揭秘”的课程,他用不到200行的代码实现了一个ASP.NET Core Mini框架,重点讲解了7个核心对象,围绕ASP.NET Core最核心的本质—由服务器和若干中间件构成的管道来介绍.我在腾讯视频上看到了这个课程的录像,看了两遍之后结合蒋金楠老师的博客<200行代码,7个对象—让

ASP.NET Core使用NLog记录日志

1.根目录新建nlog.config配置文件 <?xml version="1.0"?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" internalLogLevel="Warn&qu

在asp.net core中使用NLog

第一步:nuget  引入  NLog.Web.AspNetCore 4.5+ 第二步:放入nlog.config <?xml version="1.0" encoding="utf-8" ?><nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&qu

VisualStudioCode创建的asp.net core控制台程序部署到linux

1.asp.net core控制台程序 static void Main(string[] args) { int times=10; while(times>=0) { Console.WriteLine("Hello World!"); times--; Thread.Sleep(1000); } } 2.发布 发布前,修改test2.csproj文件(项目名称为test2) <Project Sdk="Microsoft.NET.Sdk">

Add JWT Bearer Authorization to Swagger and ASP.NET Core

Add JWT Bearer Authorization to Swagger and ASP.NET Core If you have an ASP.NET Core web application that already has JWT authorization, this guide will help you add JWT (JSON Web Token) support to the Swagger UI. What is Swagger UI? Swagger UI is a