Custom membership in mvc entity framework 6 - asp.net-mvc

I am using Entity Framework 6 in my project and applying custom membership for the project. Custom membership is located in different project of a same solution. I referenced the main project and the database but i am still getting the error on dbcontext....
The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. E:\Project\ECommerce\ECommerce\Authentication\Authentication.cs 180 13 Authentication

In adition to the main project and database references, you have to add the reference to the Entity Framework Nuget package to the project with the custom membership authentication stuff.

Related

VS2019 Reference a foreign project and its packaged assemblies in .Net 5.0

To recap how .net framework references work: Assume I have a .net framework class project called ProjectFw which references a .dll called Grpc.dll. When I create a new Solution as a .net framework console project called ProjectFwRef which adds a reference to ProjectFw.dll the build automatically brings the .dll Grpc.dll into the release folder of ProjectFwRef.
But .net 5.0 does not do that: Assume I have a .net 5.0 class project called ProjectNet which references a package called Grpc. When I create a new Solution as a .net 5.0 console project called ProjectNetRef which adds a reference to ProjectNet.dll the build DOES NOT automatically bring the Grpc.dll nor Grpc package into the release folder of ProjectNetRef.
This fundamental difference in how foreign .dlls are imported into a .net 5.0 project begs the question of the best way to deal with it. One obvious answer is to manually add the package Grpc to ProjectNetRef. Am I missing a better solution? What if I do not know the .dll's a foreign project references? Do I have to wait for the dreaded 'Cannot load file or assembly' error to find out what package I should have added?

Entity framework 6 generate file per entity

I am a beginner of Entity framework and i am trying to migrate ( as per the migration guidelines ) one of the project from entity framework 4 to entity framework 6. At present, all entities in that project are present in separate cs file and the same way i wanna keep it after migrate to EF6. I have seen some example how to keep entities in seperate files in EF4 ( model.tt template file ) but i could not find any example how to do it EF6 ( model.tt template file )
The model.tt file is similar to this link
https://github.com/vc3/ExoModel/blob/master/ExoModel.EntityFramework/DataModel.tt
Please help to how keep entities in separate file in EF6

Error compiling C# project with Protractor.dll as reference

We are developing a framework on top of Protractor/Selenium framework. Our projects are all C# signed projects. So, we need to reference signed Protractor and Selenium dlls.
I used the signed WebDriver.dll and Webdriver.Support.dll (version 2.46) from here.
But, when I compile my project, I am getting the below error -
"The type 'OpenQA.Selenium.Internal.IWrapsDriver' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=2.46.0.0, Culture=neutral, PublicKeyToken=null'."
How can I address this error and get my code running?

MvvmCross Tutorial - Portable Class Library assembly reference error - MonoDroid

I am really eager to get started with MvvmCross - it looks like a very promising framework for cross-platform solutions. Anyway, I am having a build error as I'm going through the tutorial, https://github.com/slodge/MvvmCross/wiki/Tutorial-Part-1. The error arises in building the Android project component. This is the error:
Error 1 The type 'Android.App.Activity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. C:\Users\Steven\documents\visual studio 2010\Projects\Tutorial\Tutorial.UI.Droid\Views\MainMenuView.cs
I saw some similar questions posted (Portable Class Library strong assembly reference problems in MonoTouch/MonoDroid) and followed the suggested solutions but without success. This was in VS2012, so I tried it in VS2010 and encountered the same problem. Has anyone come across this error? The PCL portion (Tutorial.Core) builds fine on its own. I checked the PCL csproj file and saw it is using Profile 104 and I did already create the MonoAndroid xml file that sits in that directory:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks\MonoAndroid,Version=v1.6+.xml
The reference for Mono.Android in the Tutorial.UI.Droid project appears to be fine. The path for the dll is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll and VS reports Resolved=True and Strong Name=True for this reference.
Any help would be greatly appreciated.
Your problem has nothing to do with PCL. Starting version 4.2, Mono for Android assemblies are strong-named i.e. assemblies shipped by Xamarin will be signed with a Xamarin key. Earlier the assemblies were either not signed or only delay-signed. This change affects the strongnames of some Xamarin assemblies.
Like in your case, it is asking you to add reference to:
Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd
which is strong-named. At present you'd be using:
Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
which is not strong-named.
So all you need to do is re-build all your assemblies (in MVVMCross as well as any other projects you may have) that refer Mono.Android with the new strong-named assembly.
That should fix your problem.

Adding Ninject.MVC3 to existing MVC(4) project

I am working on a project with MVC4, and have decided that I wish to add some dependency injection via Ninject. After download/install via NuGet, I find this error in the NinjectWebCommon.cs (Line 23):
The type 'System.Web.IHttpModule' is defined in an assembly
that is not referenced. You must add a reference to assembly
'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
and then a bit later (line 44):
The type or namespace name 'IHttpModule' could not be found
(are you missing a using directive or an assembly reference?)
I expect that this Normally works, but that I've done something that doesn't work when adding Ninject to the project after the fact.
Edit: The above errors are only thrown by the test project....
Make sure you specify the System.Web reference in both the main and test project. The test projects have their own list of references to maintain. I expect you don't have System.Web in the test project.
Make sure Ninject didn't add web references to your model project.

Resources