How to print visual studio 2017 nuget project reference warnings - .net-core

Using Visual Studio 2017 Community. My .NetCoreApp 1.1 project has included 2 packages from nuget that are yielding the little yellow warning label. The packages are obviously not loading correctly and I would like to know why.
I have looked in output
I have looked in package manager console
I have built and rebuilt the project
The packages in question are :
Microsoft.AspNetCore.WebSockets (1.0.1)
Microsoft.AspNetCore.WebSockets.Protocol (0.1.0)
Additionally, this is not an issue with my other .NetCore 1.1 project in the same solution.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets.Protocol" Version="0.1.0" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets.Server" Version="0.1.0" />
</ItemGroup>
</Project>

Related

Upgrade my Azure Function from .net Core 3.1 to .net Core 7.0. Error "'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstraction

I have an Azure Function which run on .net core 3.1, but when i change the .net version from 3.1 to 7 i got this error:-
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.'
here is a screen shot:-
here is my csproj file:-
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.15.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
<PackageReference Include="PnP.Core.Auth" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Any advice on this please?
I have installed Install-Package Microsoft.Extensions.Configuration.Abstractions -Version 7.0.0 but this did not fix the issue either.
.NET 3.1 is in-process and .NET 7 is Isolated Worker Process type.
I can see your .csproj file code given in the question that you changed only .NET Framework and Azure Functions Version which is not complete configuration code for .NET 7 Isolated Process Azure Function and also you're missing few Function Worker package references in the .csproj file code.
Basic/Default .NET 7 Isolated Azure Functions Project contains the below code in .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.8.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
.NET 7 In-Process is not yet released and to convert from .NET 3.1 (In-Process Model) to .NET 7 (Isolated Worker Process), you need to write the .NET 7 Isolated Compatible NuGet Packages, code changes in the Function Code, program.cs file, etc.,
Refer to this MS Doc for Migration Steps & Checks of Azure Functions V3 to V4 and One of the my answers SO #74428448 states the update of the supported available version in Azure Functions C#.

VS2019 Error Says Project is Targetting 'netcoreapp3.1' when it is Targetting netcoreapp2.2

I have a multi-project solution that was working fine in VS2017, I've installed VS2019 and on compile I receive five error messages:
Four of the format: This version of Microsoft.AspNetCore.App is only compatible with netcoreapp2.2 taret framework. Please target netcoreapp2.2 or chose a version of Microsoft.AspNetCore.app compatible with netcoreapp3.1
And one of the format: Project '..\project-path\project.csproj' targets 'netcoreapp3.1;. It cannot be reference by a project that targets '.NETCoreApp,Version=v2.2'
Additionally if you look at the projects referenced in the error messages the Dependencies, Packages, SDK all have the yellow warning symbol on them (hover and right-click don't seem to provide additional details)
I've tried cleans, delete bin and obj folders, rebuilds, checking SDK versions, but no luck
I can confirm I have a global.json with the SDK version (2.2.103) and that when in any of these projects directories and I run 'dotnet --verson' I get back 2.2.103
What is happening here? What / where is it picking up netcoreapp3.1 from and how do I resolve these errors?
Update: CSPROJ Details
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="appsettings.json" CopyToOutputDirectory="Always" />
<None Include="favicon.ico" CopyToOutputDirectory="Always" />
<None Include="appDevLocalOverride.json" />
<PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="3.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.AzureKeyVault.HostingStartup" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup>
I'm not sure why or how this works, but I have stumbled on a solution:
Open the csproj
Edit <PackageReference Include="Microsoft.AspNetCore.App" /> to <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
Build > Clean Solution
Manually remove ALL bin and obj folders (even if they are only remotely related to the solution)
Build > Rebuild Solution
Edit <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" /> to <PackageReference Include="Microsoft.AspNetCore.App" />
That seemed to work for me, why a simple Clean Solution and Rebuild wasn't the answer is odd; but hopefully this will help someone else!

Process creation failed with error: Access is denied when starting project in debug mode

I have an ASP.NET Core project targeting net4.6.1
The following error is thrown every time I try to start the project with debugging, from both VS2017 and command line using dotnet run.
The csproj is the following:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<Platforms>x64</Platforms>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
<StartupObject></StartupObject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\pathToAnotherProject\myproject.csproj" />
</ItemGroup>
</Project>
I can mention that I have a single startup project created as an ASP.NET Core project and multiple .net core class library projects targeting net461.
Any idea where the problem comes from?
Have you tried to enable 'use managed compatibility mode' in the debugging>general section of VS2017 options.

Nuget Packages Conflict .net core

I'm working on creating sample for clean architecture. When I had made core and infrastructure projects there were no problems. No I had add new API project and I got problem, picture bellow
I had tried to add project references in csproj but still have a problem, can anyone help me to fix this problem ?
Here is the link for project: https://github.com/danijel88/Clean-Architecture
Regards,
Danijel
Here's a question similar to yours
Here's a sample .csproj. Be sure to have
<TargetFramework>netcoreapp2.2</TargetFramework>
Make sure your project is on 2.2 before updating your packages to 2.2.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Gelf.Extensions.Logging" Version="1.5.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.1" />
<PackageReference Include="SlackLogger" Version="2.0.5" />
<PackageReference Include="System.Xml.Linq" Version="3.5.21022.801" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nozomi.Infra.Preprocessing\Nozomi.Infra.Preprocessing.csproj" />
<ProjectReference Include="..\Nozomi.Infra.Service.Identity\Nozomi.Infra.Service.Identity.csproj" />
<ProjectReference Include="..\Nozomi.Infra.Service\Nozomi.Infra.Service.csproj" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Areas\Identity\Pages\_ViewImports.cshtml" />
</ItemGroup>
</Project>

newtonsoft.json 9.0.1 not compatible with netcoreapp1.1 in newly created Visual Studio Project

I created a new ASP.NET Core Web Application in Visual Studio 2017 and immediately got the following error:
Restoring NuGet packages...
Package Newtonsoft.Json 9.0.1 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Newtonsoft.Json 9.0.1 supports:
- net20 (.NETFramework,Version=v2.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
- netstandard1.0 (.NETStandard,Version=v1.0)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
NuGet package restore failed.
It seems that Newtonsoft.Json is not compatible with netcoreapp, but why would VisualStudio include it if that is the case? I'm pretty new to ASP.NET so maybe there is something I am missing? I followed the steps from the ASP.NET Core Docs.
While searching I found some similar issues, but none seem to be compatible with VS 2017.
Also here is my .csproj file if it helps:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
Ok, I just reinstalled Visual Studio, repaired it from the installer and cleared the NuGet Cache and now it's working. Seems like something wasn't setup correctly.

Resources