1

I create a new project with ASP.NET Core Web Application(.NET Core). And it can work after building and running it.

I create a class library with .NET Core and move the files under Service folder in the web project to the library, then add the reference and change namespace in the controllers.

It occurs MissingMethodException after registering a new user.
Asp.net core project seems not able to use class library outside the web project.

The detailed message is as the below.

enter image description here

ekad
  • 14,436
  • 26
  • 44
  • 46
letitbe
  • 657
  • 1
  • 5
  • 18
  • You move "the files" - what files are you talking about, exactly? The (C#?) source files, the compiled dll, or something else? – Hans Kesting Jul 14 '16 at 06:23
  • They are C# source files. IEmailSender.cs, ISmsSender.cs and MessageServices.cs. – letitbe Jul 14 '16 at 06:36
  • With a class library, you either use a separate project within the same solution and add a reference to that project in the main project, or (when the library is a separate solution) you add a reference to the compiled dll. No need to copy source files. – Hans Kesting Jul 14 '16 at 06:40
  • The class library and main project are under the same solution. – letitbe Jul 14 '16 at 06:48
  • I think this issue is related to https://github.com/aspnet/Tooling/issues/245 – letitbe Jul 14 '16 at 08:16
  • I also post the questions on https://github.com/aspnet/Mvc/issues/5019#issuecomment-232687633 and the answer is all project.json of the class libraries need to refer to the same version in "Microsoft.NETCore.App": { "version": "1.0.0-rc2-3002702", "type": "platform" }, – letitbe Jul 14 '16 at 16:43

1 Answers1

0

In ASP.NET Core , everything is in form of nuget packages, hence you might have to create nuget package from the class library and then add it to the current solution.

Hope this information helps.

Nagashree Hs
  • 843
  • 6
  • 18