简体   繁体   English

System.Net.Http DLL 未复制到 bin 文件夹中 - IdentityServer4.AccessTokenValidation

[英]System.Net.Http DLL not copied into bin folder - IdentityServer4.AccessTokenValidation

I have a API project that uses .net core project using full .net 4.6.1 I was updating one of my nuget packages that uses Identity Server 4 and was making sure it was not conflicting with some of my old code so I deleted the bin folder content.我有一个 API 项目,它使用完整的 .net 4.6.1 使用 .net 核心项目我正在更新我的一个使用 Identity Server 4 的 nuget 包,并确保它与我的一些旧代码没有冲突,所以我删除了 bin文件夹内容。

I rebuild the project and its now unable to inject my nuget package saying it can't find system.net.http 4.1.1.0.我重建了项目,现在无法注入我的 nuget 包,说它找不到 system.net.http 4.1.1.0。 After many hours of slowly ruling things out it turns out that when the project rebuilt and put all its DLLs into the bin folder it did not copy the system.net.http DLL.经过几个小时的慢慢排除后,事实证明,当项目重建并将其所有 DLL 放入 bin 文件夹时,它没有复制 system.net.http DLL。

What is odd is when I create a new .net core API project using .net 4.6.1 and delete the bin folder and rebuild it does copy the system.net.http dll.奇怪的是,当我使用 .net 4.6.1 创建一个新的 .net core API 项目并删除 bin 文件夹并重建它时,它确实复制了 system.net.http dll。

So my question is - how do I make sure the DLL is copied into the bin folder so this does not happen to someone else working on the project?所以我的问题是 - 我如何确保将 DLL 复制到 bin 文件夹中,以免其他人在该项目上工作?


Update 2017-03-03 11:00更新 2017-03-03 11:00

So I have found out what is breaking my project but I cant work out why / how to fix it.所以我发现了是什么破坏了我的项目,但我不知道为什么/如何解决它。

1) If you create a blank .net core API project change it to use .net461 clean your bin folder and build it you will see the System.Net.Http DLL within the folder "bin\\Debug\\net461\\win7-x64". 1) 如果您创建一个空白的 .net core API 项目,请将其更改为使用 .net461 清理您的 bin 文件夹并构建它,您将在文件夹“bin\\Debug\\net461\\win7-x64”中看到 System.Net.Http DLL。

2) Now add IdentityServer4 AccessTokenValidation to the dependencies 2) 现在将 IdentityServer4 AccessTokenValidation 添加到依赖项

 "IdentityServer4.AccessTokenValidation": "1.0.5"

3) Clear your bin folder again 3)再次清除您的bin文件夹

4) Build project and you will see the System.Net.Http DLL is missing. 4) 构建项目,您将看到 System.Net.Http DLL 丢失。

The project should still work when you run it but I am using a nuget package that needs that missing DLL...当您运行该项目时,该项目应该仍然可以工作,但我使用的是需要缺少 DLL 的 nuget 包...

System.Net.Http should be a reference in the project that uses it. System.Net.Http 应该是使用它的项目中的引用。 Get the reference's properties and set the property "Copy Local" to true.获取引用的属性并将属性“Copy Local”设置为 true。

If all of the options you did didn't work, please try restarting (close / open as "admin") your visual studio, then clean / rebuild.如果您所做的所有选项都不起作用,请尝试重新启动(以“管理员”身份关闭/打开)您的 Visual Studio,然后清理/重建。 This has fixed my problem.这解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM