Ananda Prasad Jaisy
Ananda Prasad Jaisy

Reputation: 301

Class library reference is not working in Asp.net 5 mvc 6 web application

enter image description here

The reference is added to the project SharpFitness web as we can see in the image highlighted.However I the code is showing an error as cannot resolve the symbol.

Here is the project.json file

{
  "userSecretsId": "aspnet5-SharpFitnessWeb-1950ae2a-a3b9-4eaa-b94f-091f3d9afdfa",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Repository": "1.0.0-*"

  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
      }
    }

  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

The code show the reference in the project.json file. Where I am doing the mistake it tool my whole day to figure out but still not able to solve the problem.

Here is the reference code of repository

namespace Repository.Business.Interface
{
    public interface IRepositoryServiceCall<T> where T: class
    {
        GenericResponseObject<T> RepositoryGet(string actionname, KeyValuePair<string, string> ketKeyValuePair);
        GenericResponseObject<T> RepositoryPost(string actionname, T model);
    }
}

Repository project.json file

{
  "version": "1.0.0-*",
  "description": "Repository Class Library",
  "authors": [ "ajaisy" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "net451": { }
  },
  "dependencies": {
    "ServiceLayer": "1.0.0-*"
  }
}

Upvotes: 1

Views: 719

Answers (1)

Tarco
Tarco

Reputation: 36

The Reason for that problem is the renaming of the Net.Framework labels. See more https://github.com/aspnet/Home/issues/1047

Your repository uses

"frameworks": {
   "net451": { }
},

Your MVC Application uses

"frameworks": {
   "dnx451": {}
},

So you have to use the same framework Label in both projects.

"frameworks": {
   "dnx451": { },
   "dnxcore50": { }
},

Upvotes: 2

Related Questions