当它似乎被添加到项目时,引用丢失的错误
Error that reference is missing when it seems to be added to project
我正在研究 ASP.Net MVC 5/ASP.Net 核心,在尝试构建项目时遇到错误。
错误本身很简单:
Error CS0234 The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
但是……确实如此。 C# 文件中的 class 名称是正确的 'coloured',如果我将鼠标悬停在它上面,Visual Studio 就会明白它是什么(下图中的 class Entity
)。
我的主要项目是一个网络应用程序,但这个问题出现在同级 'Class Library (package)' 项目中。引用由 nuget 添加。
知道我可能做错了什么或者我可能想尝试调试的地方吗?
project.json
看起来像这样:
{
"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"
}
}
}
}
当您同时针对 net451 和 dotnet5 时,您引用的 NuGet 包只有 "full" 框架实现。实体 class(星号)的工具提示应该让您了解错误。
你有两个选择
- 从目标框架中删除 dotnet5 - 这意味着您的应用程序只能在 Windows 和框架 451
上运行
- 使用条件编译来分离两个框架的实现。
例如
#if DNX451
// utilize resource only available with .NET Framework
#endif
我正在研究 ASP.Net MVC 5/ASP.Net 核心,在尝试构建项目时遇到错误。
错误本身很简单:
Error CS0234 The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
但是……确实如此。 C# 文件中的 class 名称是正确的 'coloured',如果我将鼠标悬停在它上面,Visual Studio 就会明白它是什么(下图中的 class Entity
)。
我的主要项目是一个网络应用程序,但这个问题出现在同级 'Class Library (package)' 项目中。引用由 nuget 添加。
知道我可能做错了什么或者我可能想尝试调试的地方吗?
project.json
看起来像这样:
{
"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"
}
}
}
}
当您同时针对 net451 和 dotnet5 时,您引用的 NuGet 包只有 "full" 框架实现。实体 class(星号)的工具提示应该让您了解错误。
你有两个选择
- 从目标框架中删除 dotnet5 - 这意味着您的应用程序只能在 Windows 和框架 451 上运行
- 使用条件编译来分离两个框架的实现。
例如
#if DNX451
// utilize resource only available with .NET Framework
#endif