问题描述
我正在将我的 ASP.NET Core RC1 应用程序升级到 RC2.我在一些 *.cs 文件中有一些对 System.DirectoryServices
和 System.DirectoryServices.AccountManagement
的引用,以便我可以查询 LDAP.但我不知道如何在 Project.json
文件中的 RC2 中添加对它的引用.我尝试的一切只会给我更多的错误.任何帮助表示赞赏.
I am upgrading my ASP.NET Core RC1 application to RC2. I have some references to System.DirectoryServices
and System.DirectoryServices.AccountManagement
in some *.cs files so that I can query LDAP. But I have no idea how to add references to it in RC2 in the Project.json
file. Everything that I try just gives me more errors. Any help is appreciated.
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "default"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview1-final",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Newtonsoft.Json": "8.0.3",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"System.Linq": "4.0.1-beta-23516",
"System.Linq.Queryable": "4.0.1-beta-23516"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}
推荐答案
目前,新的 CoreCLR 不支持此库.有一个关于此的开放 GitHub 问题,您可以在其中找到更多信息和讨论.(如果您的身份验证系统仅使用 AD,则此处提供了一种解决方法.)
The new CoreCLR doesn't support this library, at the moment. There's an open GitHub issue about this, where you can find more information and discussion. (A workaround is presented there if you are only using AD for your authentication system.)
如果您只打算在 Windows 服务器上运行此应用程序,您可以为框架定位net452"并在其下添加框架程序集.
If you're only planning on running this app on a Windows server, you could target "net452" for the framework and add the framework assemblies underneath that.
"frameworks": {
"net452": {
"frameworkAssemblies": {
"System.DirectoryServices": "4.0.0.0",
"System.DirectoryServices.AccountManagement": "4.0.0.0"
}
}
},
这篇关于在 ASP.NET Core 中使用 DirectoryServices的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!