简体   繁体   English

复制参考Asp.net MVC项目错误

[英]Copying References Asp.net MVC Project Error

I am trying to work on an asp.net project and am having some issues that I don't understand how to fix. 我正在尝试一个asp.net项目,遇到了一些我不知道如何解决的问题。

I am new to ASP.NET and am learning step by step. 我是ASP.NET的新手,正在逐步学习。

I have watched some courses on Lynda as well as Pluralsight and wanted to try creating a full project. 我看过有关Lynda和Pluralsight的一些课程,并想尝试创建一个完整的项目。

I was told by the person teaching me to separate my project into 3 layers 教我的人告诉我将我的项目分为3层

  • Data Layer 资料层
  • View Layer 查看层
  • Service Layer 服务层

So after creating the project, I right clicked on my solution and added 2 new class libraries for the data and service layers. 因此,在创建项目后,我右键单击解决方案并为数据和服务层添加了2个新的类库。

Then I tried to move the code int the Models folder from the View Layer > Data Layer, and my project started showing errors and not compiling ( I assume from missing all the entity framework references). 然后,我尝试将代码从“视图层”>“数据层”移动到“模型”文件夹中,并且我的项目开始显示错误并且没有进行编译(我以为丢失了所有实体框架引用)。

Then I tried click References on my Data Layer library > add Reference and referencing the view layer. 然后,我尝试单击数据层库上的“引用”,然后添加“引用”并引用视图层。

That didn't work. 那没用。

Then, I installed visual studio productivity power tools 2017 to enable the power commands section for copying references. 然后,我安装了Visual Studio生产效率电动工具2017,以启用电源命令部分来复制参考。

Then I went to the view layer, copy references and tried pasting into the data layer, and it generated an error saying: 然后,我进入了视图层,复制了引用并尝试粘贴到数据层中,它产生了一条错误消息:

Error HResult E_Fail has been returned from a call to a COM component.

I know when I did the project as 1 layer and I did enable-migrations and update-database all would work, and I assume I have to do that after I get my data layer working. 我知道当我将项目作为1层进行时,我确实启用了迁移和更新数据库,这些都可以正常工作,我想我必须在数据层正常工作后再进行此操作。

Is there anything I am doing wrong or incorrectly. 我做错了什么吗?

Thanks, 谢谢,

删除所有项目的csproj.user文件应该可以解决此问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM