1

I am trying to work on an asp.net project and am having some issues that I don't understand how to fix.

I am new to ASP.NET and am learning step by step.

I have watched some courses on Lynda as well as Pluralsight and wanted to try creating a full project.

I was told by the person teaching me to separate my project into 3 layers

  • 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.

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.

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.

Is there anything I am doing wrong or incorrectly.

Thanks,

Dave
  • 41
  • 2
  • 8

1 Answers1

0

Deleting csproj.user files of all the projects should fix this issue.

Rex
  • 521
  • 3
  • 8
  • Rex, I did that and then referenced the ViewLayer Project from the Data Project. The project still fails to compile. Previously when i deleted csproj.user file and restarted the project it did compile, but my machine hung and froze when it was rendering the page. – Dave Oct 03 '17 at 20:35
  • The issue still remains that I am unable to copy references themselves without referencing the entire library. The page shows the loading screen but the Visual Studio instance freezes and has to be crashed to allow my computer to work. Is there something that I need to do to reference the references correctly. – Dave Oct 03 '17 at 20:39
  • Try cleaning the solution and re-build. – Rex Oct 03 '17 at 20:43
  • `1>------ Clean started: Project: LottoSite.ServiceLayer, Configuration: Debug Any CPU ------` `2>------ Clean started: Project: LottoSite.DataLayer, Configuration: Debug Any CPU ------` `3>------ Clean started: Project: LottoSite.Tests, Configuration: Debug Any CPU ------` `4>------ Clean started: Project: LottoSite.ViewLayer, Configuration: Debug Any CPU ------` `========== Clean: 4 succeeded, 0 failed, 0 skipped ==========` – Dave Oct 03 '17 at 20:44
  • Rex, Once I did the clean and rebuild all the errors returned. So i closed and reopened visual studio. Visual Studio still hangs and the chrome instance keeps spinning. Tomorrow, I will host to a public git repo so someone can take a look and assist with the compilation if they are able to. Thanks – Dave Oct 03 '17 at 20:52
  • That helps to figure out the exact cause. – Rex Oct 03 '17 at 20:53
  • Rex, After some looking into my project, I believe I am setting it up incorrectly. Is there a github repo or a tutorial I can follow to setup an application with the MVC standard and doing the 3 layer architecture (showing what to click and to create 3 different class libraries). Ideally, I believe I would like it like this: – Dave Oct 11 '17 at 14:30
  • I believe I would like it like this (please let me know if I am putting something wrong): - Service Layer > Reference newtonsoft json (I believe) / Models controllers would be here - Data Layer > References to EF and having the connectivity here. - View Layer > designed by default template.View Layers only here. Thank you in advance for all your help. Sorry for the formatting issues. – Dave Oct 11 '17 at 14:36
  • I'm not seeing issue with the setup that you explained. Can you host your solution in git repo so that we can look at it? – Rex Oct 11 '17 at 19:13