如何将项目引用添加到ASP.NET Core 1.0 MVC项目

编程入门 行业动态 更新时间:2024-10-26 03:24:13
本文介绍了如何将项目引用添加到ASP.NET Core 1.0 MVC项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在解决方案X中有一个ASP.NET Core 1.0 MVC应用程序,在解决方案Y中有一些常见项目( 4.5.2类库).

I have a ASP.NET Core 1.0 MVC app in solution X and I have some common projects ( 4.5.2 class libs) in solution Y.

当我通过添加引用->浏览..时,我想从我的应用程序引用解决方案Y中的项目.

I want to reference the projects in solution Y from my app, when I do so via add reference -> Browse .. I get:

.NET Core projects only support referencing .NET framework assemblies in this release. To reference other assemblies, they need to be included in a NuGet package and reference that package.

然后我创建了那些项目的nuget包,添加了包含nuget包的文件夹作为回购源,并加载了项目.这会将项目成功添加到我的project.json中,但实际上什么都没有发生",我仍然无法使用应用程序中的代码.

I then created a nuget package of those projects, added the folder that contains the nuget packages as a repo source and loaded the projects. This adds the projects successfully to my project.json, but 'nothing' else actually happens, I still can't use the code in my app.

现在ASP.NET Core已经超过其Beta版状态,处理此问题的正式方法是什么?

Now ASP.NET Core is past its beta status, what is the official way of dealing with this?

推荐答案

许多人为此问题苦苦挣扎,并且有在GitHub上长期运行的线程.甚至使用最新RC3版本的人都在报告您遇到的相同问题.

Many people have struggled with this issue and there is a long running thread on GitHub about it. Even the people using the latest RC3 build are reporting the same problem that you are having.

我能够在ASP.NET Core Web应用程序中引用类库项目的唯一方法是在Visual Studio 2015 Update 2中创建Web应用程序和类库项目,而且它们都必须以target为目标. NET Framework 4.6.1.

The only way I've been able to reference class library projects in an ASP.NET Core web application is to create both the web application and the class library projects in Visual Studio 2015 Update 2. And they all have to target .NET Framework 4.6.1.

我不得不将代码从旧的类库项目复制到新的项目中.但是最后,我认为我不必浪费很多时间来解决很多人无法解决的所有变通方法,从而节省了时间.

I had to copy the code from my old class library projects to the new ones. But in the end I think I saved myself time by not having to mess with all the workarounds that don't seem to work for a lot of people.

更多推荐

如何将项目引用添加到ASP.NET Core 1.0 MVC项目

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

发布评论

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

>www.elefans.com

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