随着核心的发布,我一直在尝试构建一个简单的项目,但是,每当我尝试在项目中添加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
发布评论