aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

Visual Studio - Unresolved references from portable library in ASP.NET Core App #632

Open gopokyo-colinn opened 8 years ago

gopokyo-colinn commented 8 years ago

Hi there. I am having a bit of difficulty find the cause for the following issue.

I have an ASP.NET Core project that has a reference to a PCL library project. The project compiles and runs fine, but VS has reports unresolved references to all namespaces/classes in the PCL library. It worked at some point, and then just broke and I am not sure why.

ASP.NET Core project.json `{ "userSecretsId": "aspnet-MedicalJournals.API-b87b6ab9-7adb-4fac-8c87-5889aa14b375",

"dependencies": { "System.IdentityModel.Tokens": "5.0.0-rc1-211161024", "System.Security.Cryptography.Algorithms": "4.2.0", "System.Security.Cryptography.Primitives": "4.0.0", "Microsoft.AspNetCore.Cryptography.Internal": "1.0.0", "NLog": "4.4.0-beta12", "Microsoft.ApplicationInsights": "2.1.0", "BundlerMinifier.Core": "2.0.238", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", "Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final", "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final", "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview2-final", "Sakura.AspNetCore.PagedList": "1.0.2", "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0", "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "MedicalJournals.API.Core": "1.0.0-", "MedicalJournals.Core": "1.0.0-", "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" } },

"tools": { "BundlerMinifier.Core": "2.0.238", "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final", "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { "version": "1.0.0-preview2-final", "imports": [ "portable-net45+win8" ] } },

"frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "portable-net45+win8" ],

}

},

"buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true },

"runtimeOptions": { "configProperties": { "System.GC.Server": true } },

"publishOptions": { "include": [ "wwwroot", "Views", "Areas/**/Views", "appsettings.json", "web.config" ] },

"scripts": { "prepublish": [ "bower install", "dotnet bundle" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } } `

PCL project.json

`{ "version": "1.0.0-*",

"dependencies": { "System.Security.Cryptography.Algorithms": "4.2.0", "System.Security.Cryptography.Primitives": "4.0.0", "Newtonsoft.Json": "8.0.1", "NETStandard.Library": "1.6.0", "System.Security.Cryptography.Csp": "4.0.0", },

"frameworks": { "netstandard1.6": { "imports": "dnxcore50" } } } ` Here is the project.json for the UWP project that is also using the PCL This project does not report errors

{ "dependencies": { "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.0", "Newtonsoft.Json": "9.0.1" }, "frameworks": { "uap10.0": {} }, "runtimes": { "win10-arm": {}, "win10-arm-aot": {}, "win10-x86": {}, "win10-x86-aot": {}, "win10-x64": {}, "win10-x64-aot": {} } }

image

istupakov commented 8 years ago

Same problem in .Net Core console project.

gopokyo-colinn commented 8 years ago

I'm glad I'm not alone. I'm just not sure what the standard is anymore :)

barrytang commented 8 years ago

@balachir, can you see if you can repro?

kewur commented 8 years ago

I'm having the same problem. I have a PCL, an empty ASP.net core website which references said PCL and a .netcore library that references that same PCL. Both core projects fail at resolving them on VS but runs just fine.

it might be important to note I'm using Resharper, but the resolve problems doesn't go away even if I suspend Resharper.

mvermef commented 8 years ago

part of the problem is that "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.0" is delisted due to a metapackage not containing everything that was required. there was a published work around, but there are other issues involved that the UWP isn't the only affect type of project all asp.net core apps that are RTM have this issue. I have the problem only on my mobile dev box. Which makes this even more exacerbating since I can't do jack till it's resolved.

The application pub system will kick out the publication as a failure due this if you attempt to publish

mlorbetske commented 8 years ago

TFS Bug#241362