曾经:

写了一篇:

ASP.Net Core on Linux (CentOS7) 共享第三方依赖库部署

当第二次想做相同的事,却遇上了Bug,于是有了第二篇:

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

然后:

就报告到Github上去了,来来回回和人家交涉了几天:

截几个图,给大伙学习一下英文:

我以强悍的中英文双版提交了问题:

Steps to reproduce

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
but today,when i update the Microsoft. Aspnetcore to 2.2.0 version.
it dose not work, and make me crazy.

because it always show me the msg like this:

F:\Code\OpenSource\Aries-GitHub\trunk\Aries.DevFramework\Web.UI_NetCore\bin\Rele ase\PublishOutput>dotnet Web.UI.dll Error: **An assembly specified in the application dependencies manifest (Web.UI.deps.js on) was not found**: package: 'Microsoft.AspNetCore.Authentication.Abstractions', version: '2.2.0 ' path: 'lib/netstandard2.0/Microsoft.AspNetCore.Authentication.Abstractions.d ll'
and the json like this:

"Microsoft.AspNetCore.Authentication.Abstractions/2.2.0": {
"dependencies": {
"Microsoft.AspNetCore.Http.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging.Abstractions": "2.2.0",
"Microsoft.Extensions.Options": "2.2.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Authentication.Abstractions.dll": {
"fileVersion": "2.2.0.18316"
}
}
}

我花了N长的时间在检测配置和确定路径的正确性,但结果,却依旧很悲催。
it take me much time to find out the question what it's.
when i try to maike it like this:
Microsoft.AspNetCore.Authentication.Abstractions
Microsoft.AspNetCore.Authentication.Abstractions/2.2.xxx
it work.
就是这样,只要版本号不是2.2.0,它就一切正常。
之后又几次测试,发现版本号是4.6.0也同样有问题。
and then i find the version on /4.6.0 ,it does not work also.
就是这样,版本号三位数,尾数是0的,就提示找不到dll。
how ugly this bug it's.

中英文双语版汇报之后,老外回消息了,它估计看到中文就头大:

我看了半天,也是一脸头大,于是,我努力再描述一下问题,并打算用截图说明问题:

ok,i try it again.
1、I have a mvc website:http://mvc.taurus.cyqdata.com, it run on CentOS7,at first it deploy like this :

and now it make it like this by *.deps.json:

I put the Microsoft.xxx.dll or System.xxx.dll to another folder like package.
how I do that ? I replace all the path lib/netstardardxxxx to my path.

so it work well at Microsoft.AspNetCore.All 2.0.3 version.
but my question is :when i update to 2.2.0 version,it dose not work.

if i change the version to anything like 2.2.x,it will work well.
I find it have the same bug on linux and windows. now ,you kown what i say ?

忙碌中,对方又回了一条消息:

他说他随便折腾一下,没发现问题啊。

我能怎么办?只能把demo双手奉上:

OK,I try it again.
I make a SourceCode and Demo,you can download on (5M) : http://mvc.taurus.cyqdata.com/WebPublish.rar
unrar and "dotnet Taurus.View.dll" on cmd,you will get the error message like:

and you replace 2.2.0 to 2.2.1 at Taurus.View.deps.json like this,and run again,it will be ok.

you you need the source code for building, you can download on (917K) : http://mvc.taurus.cyqdata.com/SourceCode.rar

对方告诉我,没啥问题,本来就是找不到路径文件,另外至于改版本号就变好了的问题,可能真是个bug,然后给我推荐升级到2.2版本:

Thanks a lot.

The immediate failure is caused by a missing file. The Microsoft.AspNetCore.Authentication.Abstraction.dll is in fact not there. So it fails correctly.

If you change the version you effectively corrupt the .deps.json. The entire string Microsoft.AspNetCore.Authentication.Abstraction/2.2.0 is a package identifier, which should exist in the libraries section near the end of the .deps.json file. As is the package section exists. If you change the version it won't find the package. I guess it's a bug that it won't fail in that case, in fact it simply ignores the assembly if it can't find the matching package section. This is definitely not expected, but I doubt we can fix it (if somebody relies on this behavior we would break them).

The app runs without the assembly just fine, at least the startup as I assume it doesn't need it. If it would run into code which needs it, it would fail at runtime.

Note that when I built it from source, it worked without any modifications (as the file was present).

As for the number of additional files in the app. I took your solution, changed all projects to target netcoreapp2.2 (since you're trying to use ASP.NET Core 2.2, it makes sense to target 2.2 for everything). And then I added this line to the Taurus.View_NetCore.csproj

  <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

Now when I publish the solution, I get only about 20 files in the output. Basically just the application plus 2 additional System.* assemblies.

我感觉它没发现我说的重点,于是用翻译快速上了一段文字:

To facilitate the presentation of the problem,
I put Microsoft. AspNetCore. Authentication. Abstraction. dll in the Lib directory, and then the path of the configuration file was modified to point to it, so the file is supposed to exist, even if it is not used in the project, but the direction of the path is right, I don't know if you notice it.

Version number is no problem, after all, it is automatically generated by the system.


In addition, the 2.2.0 I mentioned above refers to the Nuget version package of ASPNET Core. It is not. NetApp version upgraded to 2.2. App version is still using 2.1.

对方开始慒B了,说了一堆,然后还是推荐我上2.2版本:

I'm sorry - I don't understand your comment about the version number not being a problem. It is by design that the run fails if .deps.json refers to a file which it can't find, so in your repro, the fact that it fails is expected.
I do agree that the fact that if the version number is changed (and thus doesn't match the package in the libraries section) the run will simply ignore the problem and the file and just continue is a bug. I have my doubts we would fix it though as it might break people.
By doing this the .deps.json becomes invalid, and the current error checking is somewhat simplistic on .deps.json - this is basically expected, as the .deps.json is not meant to be used by humans - it is meant to be machine generated, and thus it's reasonable to expect correct input.

As for ASPNET Core versioning - I'm honestly surprised you can even run ASP.NET 2.2 on .NET Core 2.1, but I'm no expert in ASP.NET deployment.

To explain why you get so many files in the output:

    • Normally .NET Core apps rely on "shared frameworks" which live in the global installed location. These are referenced from the .runtimeconfig.json. You can see that your app references Microsoft.NETCore.App there, which is the root framework (contains CoreCLR and CoreFX).
    • ASP.NET itself contains lot of assemblies. Again by default this will be recognized as a "shared framework" and you would get a reference to Microsoft.AspNet.Core.App in your .runtimeconfig.json.
    • If one of the referenced shared frameworks contains the required assembly, then that assembly is not included in the output of the app. So by default you don't get pretty much any "Microsoft." or "System." assemblies in the app as those are all in the shared frameworks.
    • In your case I can only assume the build system is confused a bit - you require ASPNET Core 2.2 on .NET Core 2.1. Since no such shared framework exists, it probably just brings all the ASP.NET assemblies into the app. By migrating all projects to .NET Core 2.2 you give the build system a way to rely on shared frameworks instead. For some reason the PackageReference to ASPNET also has to be in the main project for this to work (no idea why).
    • Once that is done, your app should have a reference to Microsoft.AspNet.Core.App version 2.2 which in turn has a reference to Microsoft.NETCore.App version 2.2. And so the build system will be able to avoid all the system assemblies in the app and solely rely on the shared frameworks.

我感觉这问题似乎要无解,又要重新描述问题了:

i mean,when you down from http://mvc.taurus.cyqdata.com/WebPublish.rar
and unrar , you will find lib/Microsoft. AspNetCore. Authentication. Abstraction. dll and this dll version is 2.2.0. the file is exists.
and the Taurus.View.deps.json , you look,it point to the same path.

so,tell me ,why can't find it ,the related path is error ?

这此,对方终于知道我要表达或关注点在什么地方了:

不过它始终没Get到我的点,或者我没有Get到它的点,我只能强调,我上一版本V2.0.3是OK的,要不要弄个正常的Demo过去?

它想让我把正常的.runtimeconfig.json文件发给它看看

于是,我转身向服务器走去,我Down下了2.0.3那个运行正常的runtimeconfig.json文件,打开一看,what X,什么时候多了一行:

这不是我当年研究失败时留下的东西么,难道它是关键?

于是通过把这个属性加上和关掉,重新运行了一下,XYZ,还真是它的问题,只有配置了这个路径,deps.json上的路径才能生效

故事的结局:

感觉要分手了,给它回了最后一段话:

好聚好散,但它还是坚持让我升级到NetCore 2.2版本:

交涉地址:https://github.com/dotnet/core-setup/issues/5588

最后,发现在Github留下问题,还是有点乐趣的~~~

ASP.NET Core 共享第三方依赖库部署的正常打开方式的更多相关文章

  1. 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分开 ...

  2. ASP.Net Core on Linux (CentOS7) 共享第三方依赖库部署

    背景: 这周,心情来潮,想把 Aries 开发框架 和 Taurus 开发框架 给部署到Linux上,于是开始折腾了. 经过重重非人的坑,终于完成了任务: Aries on CentOS7:mvc.a ...

  3. 从头认识一下docker-附带asp.net core程序的docker化部署

    从头认识一下docker-附带asp.net core程序的docker化部署 简介 在计算机技术日新月异的今天, Docker 在国内发展的如火如荼,特别是在一线互联网公司, Docker 的使用是 ...

  4. ASP.NET Core中的依赖注入(1):控制反转(IoC)

    ASP.NET Core在启动以及后续针对每个请求的处理过程中的各个环节都需要相应的组件提供相应的服务,为了方便对这些组件进行定制,ASP.NET通过定义接口的方式对它们进行了"标准化&qu ...

  5. ASP.NET Core中的依赖注入(5):ServicePrvider实现揭秘【补充漏掉的细节】

    到目前为止,我们定义的ServiceProvider已经实现了基本的服务提供和回收功能,但是依然漏掉了一些必需的细节特性.这些特性包括如何针对IServiceProvider接口提供一个Service ...

  6. ASP.NET Core中的依赖注入(2):依赖注入(DI)

    IoC主要体现了这样一种设计思想:通过将一组通用流程的控制从应用转移到框架之中以实现对流程的复用,同时采用"好莱坞原则"是应用程序以被动的方式实现对流程的定制.我们可以采用若干设计 ...

  7. ASP.NET Core中的依赖注入(3): 服务的注册与提供

    在采用了依赖注入的应用中,我们总是直接利用DI容器直接获取所需的服务实例,换句话说,DI容器起到了一个服务提供者的角色,它能够根据我们提供的服务描述信息提供一个可用的服务对象.ASP.NET Core ...

  8. ASP.NET Core中的依赖注入(4): 构造函数的选择与服务生命周期管理

    ServiceProvider最终提供的服务实例都是根据对应的ServiceDescriptor创建的,对于一个具体的ServiceDescriptor对象来说,如果它的ImplementationI ...

  9. ASP.NET Core中的依赖注入(5): ServiceProvider实现揭秘 【总体设计 】

    本系列前面的文章我们主要以编程的角度对ASP.NET Core的依赖注入系统进行了详细的介绍,如果读者朋友们对这些内容具有深刻的理解,我相信你们已经可以正确是使用这些与依赖注入相关的API了.如果你还 ...

随机推荐

  1. Linux时间子系统之三:时间的维护者:timekeeper

    专题文档汇总目录 Notes: 原文地址:Linux时间子系统之三:时间的维护者:timekeeper 本系列文章的前两节讨论了用于计时的时钟源:clocksource,以及内核内部时间的一些表示方法 ...

  2. 聊聊 Spring Boot 2.x 那些事儿

    本文目录: 即将的 Spring 2.0 - Spring 2.0 是什么 - 开发环境和 IDE - 使用 Spring Initializr 快速入门 Starter 组件 - Web:REST ...

  3. 你不知道的JavaScript--Item27 异步编程异常解决方案

    1.JavaScript异步编程的两个核心难点 异步I/O.事件驱动使得单线程的JavaScript得以在不阻塞UI的情况下执行网络.文件访问功能,且使之在后端实现了较高的性能.然而异步风格也引来了一 ...

  4. attr和prop的区别以及在企业开发中应该如何抉择

    attr和prop有很多相同的地方,比如都可以操作标签的属性节点,而且获取的时候都只可以获取到相同节点的第一个,例如这样: $('span').attr('class');和$('span').pro ...

  5. Eclipse中Maven Install时发生错误

    问题描述 要把一个本地包保存进本地maven库中, 所以对该project执行了run as => Maven Install, 结果报下面的错误. 解决办法 1. 通过命令窗口手动创建这两个文 ...

  6. Reading Code Is Hard

    注: 以下内容引自: https://blogs.msdn.microsoft.com/ericlippert/2004/06/14/reading-code-is-hard/ Reading Cod ...

  7. django(权限、认证)系统—— Permissions和Group

    接着上面的3篇讨论文章,我们阐述了Django中如何使用Authentication系统进行,用户的创建,登陆,登出,完成了用户的认证.接下来,我们要看另外一个议题,那就是Authorization授 ...

  8. 微信小程序分享到朋友圈方法与技巧

    小程序提供onShareAppMessage 函数,此函数只支持分享给我微信朋友.小程序如何分享到朋友圈呢? 我提供的方法是,使用canvas绘制一张图片,并用wx.previewImage预览图片, ...

  9. STM32F1固件库文件讲解与基于固件库新建MDK工程模板

    操作系统:win10 1.文件目录 (在cmd下用"cd 文件夹" 进入到要显示的文件夹,如cd d:\en.stsw-stm32054,然后输入tree 回车就会出现上图的目录结 ...

  10. 数字类型——python3

    今天我为各位小伙伴准备了python3中数字类型,希望能够帮助到你们! Python 数字数据类型用于存储数值. 数据类型是不允许改变的,这就意味着如果改变数字数据类型的值,将重新分配内存空间. 以下 ...