Reputation: 6715
I am poking around ASP.Net MVC 5/ASP.Net Core and am getting errors when trying to build the project.
The error is simple enough on its own:
Error CS0234 The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
But...it does. The class name in the C# file is correctly 'coloured' and if I hover over it, Visual Studio understands what it is (class Entity
in picture below).
My main project is a web app, but this problem is occurring in a sibling 'Class Library (package)' project. The reference was added by nuget.
Any ideas what I might have done wrong or where I might look to try to debug?
The project.json
looks like this:
{
"version": "1.0.0-*",
"description": "My Proj Name",
"authors": [ "Robert" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": {
"dependencies": {
"Microsoft.Crm.Sdk.Proxy": "1.0.0-*",
"Microsoft.CrmSdk.CoreAssemblies": "8.1.0"
"Microsoft.Xrm.Client": "1.0.0-*"
}
},
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
Upvotes: 2
Views: 1594
Reputation: 1125
You are referencing NuGet Package that has only "full" framework implementation while you are targeting both net451 and dotnet5. Tooltip for the Entity class (asterisk sign) should give you an idea about the error.
You have two options
e.g.
#if DNX451
// utilize resource only available with .NET Framework
#endif
Upvotes: 1