.net核心1.0 Visual Studio引用外部dll

编程入门 行业动态 更新时间:2024-10-22 09:45:26
本文介绍了核心1.0 Visual Studio引用外部dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

随着核心的发布,我一直在尝试构建一个简单的项目,但是,每当我尝试在项目中添加dll引用时,我都会收到以下消息

with the release of the core i have been trying to build a simple project, however whenever i try and add a dll reference in my project i get the following message

.Net核心项目仅支持在此版本中引用.Net Framework程序集。要引用其他程序集,需要将它们包含在nuget程序包中并引用该程序包。

我在RC2中收到了此消息,但在RC1中却没有,是否还有其他人遇到此问题,并且有人知道如何解决吗?除了git问题票证之外,我没有找到与此相关的任何内容 github/aspnet/Home / issues / 1612

i was getting this message in RC2 but not in RC1, is anyone else having this issue and does anyone know how to resolve it? i have not been able to find anything relating to this other than a git issue ticket github/aspnet/Home/issues/1612

推荐答案

要在核心中引用外部dll,您需要创建自己的nuget软件包。

For referencing external dll in core you need to create you own nuget package.

NuGet文档显示了如何从dll创建软件包: docs.nuget/create/hosting-your-own-nuget-feeds 。您可以将该nuget包放在本地文件夹中并将其用作提要:[ docs.nuget/create/hosting-your-own-nuget-feeds

The NuGet docs show how to create a package from a dll:docs.nuget/create/hosting-your-own-nuget-feeds . You can put that nuget package in a local folder and use that as a feed: [docs.nuget/create/hosting-your-own-nuget-feeds]

为此,您需要编辑nuspec文件,并在nuspec文件中添加以下代码。

For this you need to edit the nuspec file and add the following code in the nuspec file.

<package> *******--Some code--***** <metadata> <references> <reference file="xxx.dll"/> </references> </metadata> <--For addig reference of external dll--> <files> <file src="path\*.dll" target="lib\netCoreApp1.0"/> </files>

现在创建.nupkg文件并

Now create .nupkg file and install this package in your project.

希望此解决方案对您有用。

Hope this solution works for you.

更多推荐

.net核心1.0 Visual Studio引用外部dll

本文发布于:2023-11-13 14:34:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584588.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:核心   net   dll   Studio   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!