简体   繁体   English

netcoreapp1.0中的参考FrameworkAssembly

[英]Reference FrameworkAssembly in netcoreapp1.0

What is the prefered way to reference full framework assemblies like System.DirectoryServices.AccountManagement on a netcoreapp that runs windows only? 在仅运行Windows的netcoreapp上引用完整框架程序集(如System.DirectoryServices.AccountManagement )的首选方法是什么?

The dnx supported this way: dnx支持这种方式:

 "frameworks": {
    "dnx451": {
      "frameworkAssemblies": {
        "System.DirectoryServices.AccountManagement": "4.0.0.0",
        "System.Messaging": "4.0.0.0",
        "System.Runtime.Serialization": "4.0.0.0"
      }
    }
  },

and with netcore it changed to: 并使用netcore将其更改为:

 "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": "dnxcore50"
    }
  }

Using frameworkAssemblies still works for me. 使用frameworkAssemblies仍然适合我。

If you want to use the assembly directly from your ASP.NET Core application, then the project.json would look like this: 如果要直接从ASP.NET Core应用程序使用程序集,那么project.json将如下所示:

"dependencies": {
  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
  "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
},

"frameworks": {
  "net461": {
    "frameworkAssemblies": {
      "System.DirectoryServices.AccountManagement": "4.0.0.0"
    }
  }
},

If you want to do it indirectly through a class library, then the project.json in the class library would look like this: 如果你想通过类库间接进行,那么类库中的project.json将如下所示:

"dependencies": {
  "NETStandard.Library": "1.5.0-rc2-24027"
},

"frameworks": {
  "net461": {
    "frameworkAssemblies": {
      "System.DirectoryServices.AccountManagement": "4.0.0.0"
    }
  }
}

And in the application (assuming the class library is called ClassLibrary ): 在应用程序中(假设类库称为ClassLibrary ):

"dependencies": {
  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
  "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
  "ClassLibrary": "1.0.0-*"
},

"frameworks": {
  "net461": {}
},

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

相关问题 来自普通.net 4.6.2单元测试项目的参考netcoreapp1.0 - Reference netcoreapp1.0 from normal .net 4.6.2 unit test project netcoreapp1.0 没有找到 net461 特定的包 - netcoreapp1.0 does not find net461 specific package 如何指定netcoreapp1.0对本地nuget包的依赖关系? - How to specify dependency of netcoreapp1.0 on local nuget package? Microsoft.Composition 1.0.27与.NETCoreApp不兼容,版本= v1.0 - Microsoft.Composition 1.0.27 incompatible with .NETCoreApp,Version=v1.0 netcoreapp3.1 似乎引用了 C# 7.3 而不是 8 作为文档 - netcoreapp3.1 appears to reference C# 7.3 and not 8 as documented NetCoreApp2.1 System.Data参考错误 - NetCoreApp2.1 System.Data reference error 约束引用“字符串”无法解析为类型。 (netcoreapp3.0) - The constraint reference 'string' could not be resolved to a type. (netcoreapp3.0) dotnet restore fail“无法为'.NETCoreApp解决'PCLLibrary',版本= v1.0'。” - dotnet restore fail “Unable to resolve 'PCLLibrary' for '.NETCoreApp,Version=v1.0'.” 错误:使用Mailkit在.NetCoreApp V1.0中发送电子邮件时“设备未配置” - Error: 'device not Configured' when Sending Email in .NetCoreApp V1.0 using Mailkit 警告 测试运行将使用为框架 .NETCoreApp、Version=v1.0 和平台 X86 构建的 DLL - Warning Test run will use DLL(s) built for framework .NETCoreApp,Version=v1.0 and platform X86
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM