如何防止.NET 4.7.1库将Facade dll复制到bin文件夹? [英] How do I prevent .NET 4.7.1 libraries from copying the facade dlls to the bin folder?

查看:93
本文介绍了如何防止.NET 4.7.1库将Facade dll复制到bin文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定,这里可能发生了一堆我不太了解的事情,所以请原谅我这是一个愚蠢的问题,还是缺少明显的细节.

I'm certain there's probably a bunch of things going on here that I don't understand well enough, so forgive me if this is a stupid question or if there's obvious details missing.

我有一个Visual Studio 2015解决方案,我已经从.NET 4.5.1升级到.NET 4.7.1.该解决方案由一个网站(不是Web应用程序)项目和几个库组成.这些库实际上没有任何依赖关系(彼此之间除外),并且当它们针对.NET 4.7.1时,它们没有使用,不需要或引用.NETStandard.Library.

I have a Visual Studio 2015 solution that I've upgraded from .NET 4.5.1 to .NET 4.7.1. The solution consists of a website (not web app) project, and several libraries. The libraries don't really have any dependencies (except eachother) and while they are targeting .NET 4.7.1, they don't use, need, or reference .NETStandard.Library.

当我特别编译其中一个库时,它会不断将一堆.NET 4.7.1 Facade dll复制到网站bin文件夹中.不幸的是,该网站是Kentico 11应用程序,并且它一直试图加载System.IO.Compression.ZipFile门面,并对其进行扼制,因为它是参考程序集,而不是实际程序集.

When I compile one of the libraries in particular, it keeps copying a bunch of .NET 4.7.1 facade dlls into the website bin folder. Unfortunately, the website is a Kentico 11 application, and it keeps trying to load the System.IO.Compression.ZipFile facade, and chokes on it because it's a reference assembly, not a real assembly.

如果我删除.dll,则一切运行正常...但是我不想每次都删除它,也不想添加构建后事件来删除它.真是愚蠢.

If I delete the .dll, everything runs fine... but I don't want to delete it every time or add a post-build event to delete it. That's just silly.

任何人都可以帮助我了解这里发生的情况以及如何清理吗?

Can anyone help me understand what's going on here, and how to clean it up?

推荐答案

Kentico 11最多只能针对.NET 4.7,因此,为了完全支持您的.NET 4.7.1库,我相信它会在这些附加的外观中进行复制DLL.这基于.NET 4.7.1发行公告,特别是本节:

Kentico 11 can only target up to .NET 4.7 so in an attempt to fully support your .NET 4.7.1 libraries I believe it is copying in those additional facade DLLs. This is based on the .NET 4.7.1 release announcement, specifically this section:

BCL – .NET Standard 2.0支持

BCL – .NET Standard 2.0 Support

.NET Framework 4.7.1内置了对.NET Standard 2.0的支持. .NET Framework 4.7.1添加了约200个缺少的API,这些API是.NET Standard 2.0的一部分,但实际上并未由.NET Framework 4.6.1、4.6.2或4.7实现.您可以在.NET Standard Microsoft文档上参考有关.NET Standard的详细信息.

.NET Framework 4.7.1 has built-in support for .NET Standard 2.0. .NET Framework 4.7.1 adds about 200 missing APIs that were part of .NET Standard 2.0 but not actually implemented by .NET Framework 4.6.1, 4.6.2 or 4.7. You can refer to details on .NET Standard on .NET Standard Microsoft docs.

面向.NET Framework 4.6.1至4.7的应用程序必须部署其他.NET Standard 2.0支持文件,才能使用.NET Standard 2.0库.发生这种情况是因为.NET Framework 4.6.1发布之后,.NET Standard 2.0规范已完成. .NET Framework 4.7.1是继.NET Standard 2.0之后的第一个.NET Framework版本,使我们能够提供全面的.NET Standard 2.0支持.

Applications that target .NET Framework 4.6.1 through 4.7 must deploy additional .NET Standard 2.0 support files in order to consume .NET Standard 2.0 libraries. This situation occurred because the .NET Standard 2.0 spec was finalized after .NET Framework 4.6.1 was released. .NET Framework 4.7.1 is the first .NET Framework release after .NET Standard 2.0, enabling us to provide comprehensive .NET Standard 2.0 support.

https://blogs.msdn.microsoft.com/dotnet/2017/10/17/announcing-the-net-framework-4-7-1/

引用使我得出以下结论: https://github.com/Particular/NServiceBus/issues/5047#issuecomment- 339096350

Reference that led me to this conclusion: https://github.com/Particular/NServiceBus/issues/5047#issuecomment-339096350

更新:

我无法在Visual Studio 2017版本15.6.2中重现您的问题.

I was unable to reproduce your issue in Visual Studio 2017 Version 15.6.2.

我安装了一个针对.NET 4.7的Kentico 11网站项目.然后,我创建了一个针对.NET 4.7.1的库项目.我向项目添加了一些虚拟代码,以利用Sysetem.IO.Compression和System.Net.Http命名空间.我从Kentico添加了对该项目的引用,并进行了构建.没有Facade DLL复制到bin文件夹中.

I installed a Kentico 11 website project targeting .NET 4.7. I then created a library project that targeted .NET 4.7.1. I added some dummy code to the project to make use of Sysetem.IO.Compression and System.Net.Http namespaces. I added a reference to the project from Kentico and ran a build. No facade DLLs where copied to the bin folder.

此帖子表明此问题已在Visual Studio 15.6版中解决. https://github.com/dotnet/sdk/issues/1647#issuecomment-364999962

This post indicates the issue was fixed in Visual Studio version 15.6 https://github.com/dotnet/sdk/issues/1647#issuecomment-364999962

这篇关于如何防止.NET 4.7.1库将Facade dll复制到bin文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆