引用非dotnet核心项目时Intellisense不起作用
我正在Visual Studio 2015 Update 3中开发一个.net核心/ asp.net核心应用程序,该应用程序在Azure的net46框架上运行。我在我的解决方案中有几个项目文件,其中一些是用dotnet核心编写的,其中一些是从另一个解决方案(dotnet 4.6)导入的。引用非dotnet核心项目时Intellisense不起作用
我的解决方案构建并运行良好,但Intellisense(也运行ReSharper)将红色波浪线放在引用非核心库的代码下面。
我project.json看起来是这样的:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Autofac": "4.0.0-rc2-240",
"Autofac.Extensions.DependencyInjection": "4.0.0-rc2-240",
"AutoMapper": "4.2.1.0",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
"Microsoft.ApplicationInsights.TraceListener": "2.0.0",
"XXX.SystemCore": "1.0.0-*",
"XXX.Services": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"net46": {
"dependencies": {
"XXX.SystemCore": {
"target": "project"
}
}
}
},
"publishOptions": {
"include": [
"wwwroot",
"appsettings.json",
"web.config"
]
},
"runtimeOptions": {
"gcServer": true
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
以下项目的非核心的:
"XXX.SystemCore": "1.0.0-*",
"XXX.Services": "1.0.0-*"
它们也包括在其他的解决方案,所以我不能只是转换他们要核心。
的包装,project.json看起来是这样的:
{
"version": "1.0.0-*",
"frameworks": {
"net46": {
"bin": {
"assembly": "../../../XXX.SystemCore/obj/{configuration}/XXX.SystemCore.dll",
"pdb": "../../../XXX.SystemCore/obj/{configuration}/XXX.SystemCore.pdb"
}
}
}
}
请,我怎么可以删除所有从引用的项目红色波浪线? :-)
在将Web项目从ASP.NET 5 RC1升级到ASP.NET Core 1.0.0后,我在Visual Studio 2015中遇到了完全相同的问题。
使用后,Visual Studio以某种方式包含了经典(非核心)类库(.csproj)以及wrap文件夹中的包装器项目(.xproj)。 wrap文件夹由Visual Studio在使用ASP.NET 5 RC1时创建。
步骤,在我的情况下帮助:
- 关闭的解决方案,并退出Visual Studio的
- 从包文件夹中的文件系统中删除重复的xproj项目(或者如果可能的话取出完整包文件夹) 。
- 在Visual Studio中打开解决方案并删除孤立的(wrap-)项目。
- 重建。在某些情况下,我必须删除并重新添加对经典(非核心)库的引用。
结论:
是不需要的包文件夹了(> RC2)来引用经典的类库,但不知何故 - 如果仍然存在 - 似乎与Visual Studio智能感知干扰
谢谢,这在我在Visual Studio中编译和运行时似乎可行,但CLI工具(我需要用于CI构建和部署)似乎不再有效。可能相关的错误:https://github.com/dotnet/cli/issues/3199 CLI工具是否适合您?你的project.json是怎么样的? –
我无法使用CLI工具(dotnet恢复,构建,发布)。对于project.json中引用的每个经典项目(.csproj),dotnet。exe是这样给出的错误消息:'无法解析'XYZ.Domain.Interfaces(> = 1.0.0)'为'DNX,版本= v4.5.1'。'我的project.json引用经典项目看起来像这:'“XYZ.Domain.Interfaces”:{“target”:“project”}' –
是否有有红线的任何错误信息?你有没有尝试引用它们只有一次(全球对守卫)? – Thomas
我在github上发现了一个目前尚未解决的问题,它讨论了这个问题:https://github.com/aspnet/Tooling/issues/565 ...所以我想这是一个错误。 –