Target framework while publishing - asp.net-core

I am creating a publish profile for an ASP.NET CORE application. While building it I only have the option for netcoreapp2.0. Other developers have netcoreapp2.1. I just updated my Visual Studio 2017 to 15.8.0 but I still do not have this option. What do I need to install or upgrade on my computer to allow that target framework to be available while building a publish profile?

Related

Deploy ASP.NET Core 6 app to existing Azure App Service?

Based on today's announcement of the ASP.NET Core 6 release, it is my understanding that .NET 6 will be immediately available ("day 0 support") on Azure App Services via Early Access:
We are happy to announce that App Service is rolling out day 0 support for .NET 6.0 applications across all public regions and scenarios on both Windows and Linux App Service plans.
After upgrading my ASP.NET Core application to ASP.NET Core 6, configuring my Azure App Service to use .NET 6, and publishing my application to my existing Azure App Service, however, I get an HTTP Error 500.31 with the specific message:
The framework 'Microsoft.NETCore.App', version '6.0.0' (x64) was not found.
Notably, the only .NET 6 runtime it lists as available is RC2 (6.0.0-rc.2.21480.5), not today's release version.
Upgrade Steps
To facilitate this, I performed the following steps:
Project file (csproj): Updated the <TargetFramework /> to target the net6.0
Publishing profile (pubxml): Updated the <TargetFramework /> to target the net6.0
Project file (csproj): Updated all Microsoft.AspNetCore.* NuGet packages to 6.0.0
Azure App Service Configuration: Updated the .NET Version to ".NET 6 (Early Access)"
Error Message
When accessing my Azure App Service site with detailed errors enabled, however, I receive the following error:
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Specific error detected by ANCM:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '6.0.0' (x64) was not found.
The following frameworks were found:
2.2.14 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.0.3 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.15 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.18 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
5.0.7 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
5.0.9 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
6.0.0-rc.2.21480.5 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64
Additional Information
I've restarted my Azure App Service (obviously!)
I've waited (more than an hour) for the runtime to be installed via Early Access
I am publishing my web application using the Framework-dependent deployment mode
I do not have any .NET runtimes configured via Azure App Service Extensions
I do not have AspNetCoreModule(V2) configured (as was required for ASP.NET Core 3)
This Azure App Service Plan is located in the South Central US region
I am publishing from today’s release of Visual Studio 2022
Mixed Messages
While the Azure App Service update cited above suggests that there will be "day 0 support", the ASP.NET Core 6 announcement is less committed:
At the time of this post, .NET 6 is being actively deployed to the worldwide network of servers and configured to build and run .NET 6 apps… which should conclude by the end of this week
I would assume that the Azure update on GitHub would be the most authoritative source, but perhaps there are problems with the rollout that haven't yet been acknowledged by the Azure team?
Related Topics
I previously posted two questions related to publishing previous early releases of ASP.NET Core web applications to Azure App Services, and have followed the resolutions relevant to those posts, to no avail:
Error publishing an ASP.NET Core 3.1 site to Azure from Visual Studio 2019
Deploy ASP.NET Core 5 app to existing Azure App Service?
Question
How can I deploy a release version of an ASP.NET Core 6 app to an Azure App Service using the Early Access program? Is this even ready yet (as per the Azure App Service announcement)? Or do we need to wait until the end of week (as per the ASP.NET Core 6 announcement)?
Ideally, I’d like to take advantage of Early Access without either distributing the runtime with my application (as a self-contained distribution) or installing the runtime via an extension. Obviously, those remain options, but the premise of Early Access is that they shouldn’t be necessary.
Good news. This appears to have been a temporary lag between the Azure App Service team's "day 0" announcement and actual availability. As of this post, the .NET 6 runtime is now available via Early Access in, at minimum, the South Central US region—and, presumably, others as well (unconfirmed). Worst case, based on the ASP.NET Core 6 announcement, this should be globally available by the end of the week.
Migration Steps
To reiterate from the original post, to migrate you need to perform the following steps:
Project: Migrate your app from e.g., ASP.NET 5 to ASP.NET 6; notably, in the project file (csproj):
Update the <TargetFramework /> to target the net6.0
Update all Microsoft.AspNetCore.* NuGet packages to 6.0.0
Publishing profile (pubxml): Update the <TargetFramework /> to target the net6.0
Azure App Service Configuration: Updated the .NET Version to ".NET 6 (Early Access)"
Additional Information
You should not need to do any of the following:
Restart your Azure App Service
Publish your web application using the Self-contained deployment mode
Install the .NET runtime via Azure App Service Extensions
Configure the AspNetCoreModule(V2) (as was required for ASP.NET Core 3)
Workarounds
If Early Access isn't yet available in your region and you don't want to wait until the end of the week, there are two workarounds available to you, as suggested elsewhere on this thread:
Install the .NET 6 runtime via an App Service Extension (per Jason Pan's answer)
Deploy using a self-contained ASP.NET Core 6 web app (per Eric Imhauser's answer)
All said, Microsoft can at least claim this was available on "day 1" and take advantage of the ambiguity in indexing.
I ran into this problem with deploying with Azure DevOps and was completely confused. So I'm posting this to help anyone who is experiencing the same problem upgrading to .NET 6 and using Azure DevOps to deploy.
It was actually quite a small change that was needed.
In the pipeline for the release, make sure that the Runtime Stack selected is DOTNETCORE 6 (see image below)
You should change .NET version to .Net 6(Early Access).
And you also need to install extension in scm site, url like https://your_app_name.scm.azurewebsites.net. Search ASP.NET Core 6.0, and install them.
Then you can restart your webapp to check.
I have successfully deployed to an App Service using the Self-Contained Deployment Mode.
All I did is change the TargetFramework to net6.0 in the csproj file and update the nuget all packages to 6.0.0.

Does the UseDotNet#2 task install the Hosting Bundle?

Trying to understand what the UseDotnet#2 task does with regard to the Asp.Net Core Hosting Bundle. When I use this:
- task: UseDotNet#2
inputs:
packageType: sdk
version: 3.1.x
I see "Microsoft .NET Core 3.1.5 - Windows Server Hosting (x86)" in the registry, but my application seems to require "Microsoft .NET Core 3.1.8 - Windows Server Hosting (x86)" (which I expected it to install as that is version associated with 3.1.4 of the sdk, as per https://dotnet.microsoft.com/download/dotnet-core/3.1)
Can someone clarify what version of the Hosting Bundle the UseDotnet task will install?
Do I need to use this third party task instead of UseDotNet#2 https://marketplace.visualstudio.com/items?itemName=rbosma.InstallNetCoreRuntimeAndHosting
I searched in UseDotnet#2 task's source code, but found no script to download the hosting bundle, only the script to download .net Core runtime.
So if there is a hosting bundle, it's probably already in the agent.
In Microsoft-hosted Windows agent, although there was no direct evidence that hosting Bundle was installed, it had installed some .net Core runtime versions.
For Windows Server 2019 with Visual Studio 2019 (windows-latest OR windows-2019), click this link for detailed information.
For Windows Server 2016 with Visual Studio 2017 (vs2017-win2016), click this link for detailed information.
Since .net Core runtime is part of the hosting bundle, I think "Microsoft .NET Core 3.1.5 - Windows Server Hosting (x86)" might be related to these runtime versions that have been installed
What's more, you can use UseDotnet#2 task to clarify or install a specific .net Core Runtime version.
Here is an example:
- task: UseDotNet#2
inputs:
packageType: 'runtime'
version: '3.1.8'

Is the .NET Core SDK required for runtime?

I am setting up a Ubuntu machine to deploy a Asp.Net MVC Core app according to the instructions here. In it, it asks for the .NET Core SDK to be installed.
If my server is meant to just run the web application, is it necessary to install the SDK?
Also, if my app is developed in .NET Core 3.0 in Visual Studio, is it ok to have it in a .NET Core 3.1 runtime?
Runtime will be enough to run deployed application https://dotnet.microsoft.com/download/dotnet-core/3.1
In fact you don't even have to do that. Because you can also Publish self-contained package
https://learn.microsoft.com/pl-pl/dotnet/core/deploying/#publish-self-contained
Which will carry all resources needed for runnint your applicaiton on target OS
v3.1 runtime should support your application built in v3.0
From docs;
Install the SDK (which includes the runtime) if you want to develop
.NET Core apps. Or, if you only need to run apps, install the runtime.
If you're installing the runtime, we suggest you install the ASP.NET
Core runtime, as it includes both .NET Core and ASP.NET Core runtimes.
So you do not have to install SDK if you only need to run apps.
You need to install same runtime version as your project (SDK) version

Visual Studio 2015 Created Old .NET Core 1.0.1 project

I have installed .NET Core 1.1 SDK and Tooling 1.0.1 Tools Preview 2.
When I create new .NET Core project using Visual Studio 2015 it creates 1.0.1 project instead of 1.1.
Not sure how to change this ugly behavior?
That's because the templates ship with Visual Studio, which haven't received an update as part of the .NET Core release. The reason for that is probably because 1.1 is a "Current" release and 1.0.1 is an "LTS" (Long Term Support) release. Visual Studio will most likely follow the LTS releases as they provide the best and most reliable support for customers.
If you create a new application with the .NET CLI tooling (e.g. dotnet new), it will use the latest version. You can specify the type of the template with the -t switch:
dotnet new: creates a console app
dotnet new -t web: creates a full-blown web app
dotnet new -t lib: creates a class library project

How to find out if package allows to redistribute the assemblies?

I want redistribute the some assemblies from nuget packages with wix installer.
How can I check if this is allowed.
If is nuget can I assume that it is allowed to redistribute?
My quesion is for some dll-s from next nugets.
Microsoft.TeamFoundationServer.ExtendedClient - link
Microsoft.TeamFoundationServer.Client - link
Microsoft.VisualStudio.Services.Client - link
Thanks for help
These files are redistributable.
.NET client libraries for Visual Studio Team Services (and TFS)
Overview
For .NET developers building Windows apps and services that integrate
with Visual Studio Team Services, client libraries are available for
integrating with work item tracking, version control, build, and other
services are now available. These packages replace the traditional TFS
Client OM installer and make it easy to acquire and redistribute the
libraries needed by your app or service.
Refer to this link for details: .NET client libraries for Visual Studio Team Services (and TFS)