Installing specific dotnet version in azure - .net-core

I'm having an issue with a netcoreapp project that's running 2.2. In Microsoft Azure the 2 supported versions are 2.1 and 3.1, both will require some serious migrating. Is it possible to install 2.2 on the server?

Your best option would be to deploy a self-contained application. You can do so by running
dotnet publish -r <RID> --self-contained
In this way you will cut loose the depedency on the supported runtimes from Azure side.
There is of course the downside (as always) that your applications would be bigger by roughly 100Mb

Related

.NET app service need SDK to run on Linux?

We are trying to run the .net core API service on Cent OS using Nginx server. Do we need .NET SDK or run time libraries are enough to run the .NET service on Linux?
It depends on how you are publishing the application.
If your application is published as a Framework Dependent application, it will need just the .NET Runtime to be installed.
If your application is published as a Self-Contained application, it will not need the .NET Runtime to be installed (but the transitive native dependencies of .NET runtime - such as OpenSSL and ICU might be needed).
At no point should the SDK be required to run the application. If it is, you are doing something wrong, or have run into a bug.
For more details, see:
.NET Application Publishing Overview
Publishing .NET applications with the .NET CLI.
If you are targeting Linux running Intel x86_64 machines, remember to use the linux-x64 Runtime Identifier when targeting the application.

How can we bundle and install lower version of dotnet core using Wix Sharp?

We developed our application and tested over DotNet core 3.1.101 and it was working fine but what happened is Microsoft updated dotnet core to 3.1.111 and it breaks our application and we are asking customer to downgrade the core version manually that doesn't seem to be good idea.
Can somebody Wixsharp/.Net expert suggest, how can we avoid this problem? Can we have side by side installation of dotnet core and use the desired on with our application? If yes, How can we do it?
If you are really dependent of the specific net core version, the best solution to you will be to use self-containing publishing (https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained). This will create the solid bundle from your code and the your current net core version. On the client machine your app will use the net core, which is bundled with app. User may have other versions of net framework/net core installed, but these versions will not affect your app in any way.
For example, the following will create 64-bit executable for Windows
dotnet publish -r win-x64.
After you got your bundle from publish command, you need just pack the whole bundle with wix as usual. Not need to perform additional steps to install net core.

Build .NETCORE 1.0 api application in the pipeline

My application hosted in azure uses old .NETCORE 1.0 SDK. There wasn't any commits for more than a month and when I committed some changes today, it failed to build. I checked the pipeline and I found that it failed on Run dotnet with this error
A compatible installed .NET Core SDK for global.json version
[1.0.0-preview2-003131] from [D:\a\1\s\global.json] was not found.
Does it mean azure devops does not support .NETCORE 1.0 anymore? Do I need to upgrade the application to use .NETCORE 2.x?
Any help will be appreciated.
Cheers
There are several hosted agents, and the different agents have different software installed on it. The list of agents can be found here:
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops
the window 2019 hosted agent has the following software installed:
https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
the window 2016 hosted agent has the following software installed:
https://github.com/actions/virtual-environments/blob/master/images/win/Windows2016-Readme.md
As you can see in the list, the windows 2016 hosted agent still has a .net Core 1.0 version installed. If updating you project to a new .net Core version is not an option, you might be able to build your project on this agent.
You can set the agent to build to windows 2016 by using the following yaml:
jobs:
- job: Build_Web
pool:
vmImage: 'vs2017-win2016'
Agree with PaulVrugt that you should use Windows 2016 hosted agent to build your application if you do want to use .net core 1.
But you may also need an extra Use .net core Task in the first task of the pipeline to specify the version you want to use.
This task can be used to change the version of .NET Core used in subsequent tasks like .NET Core cli task. And this is necessary cause Azure Devops will automatically pick the latest version of .net core sdk unless you use this task to let the pipeline know which version of sdk do you want to use in following tasks.

Bamboo NuGet Restore command is running older version of SDK

I have a .net core 2.2 web app that has been building successfully in Bamboo for several months. Recently someone rebuilt the new Bamboo server (we're on premise, not in cloud) as the first step in a Bamboo upgrade and my build began failing. The error is:
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
My original post incorrectly asserted that this error was occurring in a Script task running dotnet publish. I realize now that it is actually occurring in the previous task - a Bamboo Command task running NuGet Restore. And I can reproduce the problem at the command line, so it does not appear to be a Bamboo issue.
So, in summary, I have a .NET Core solution with four projects. All four projects target .NET Core 2.2. I have NuGet 5.3.1 installed on my Bamboo build server. I navigate to the solution directory and run
nuget restore
And I first get the following informational message:
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
Followed by four instances of the following error, one per project:
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
What is causing the nuget restore operation to be working with .NET Core 2.1 instead of 2.2? Is there a problem with the msbuild auto-detection?
I initially found that .net core 2.2 had not been installed on the new server, so I installed it, so both are now installedre. But the error above persists and continues to reference .net core 2.1.
Instead of running nuget restore use dotnet restore.
A cleaner way to set this up would be to configure a dotnet executable as a Command in Bamboo. By doing this you can ensure that you are running the correct executable every time. Additionally you will gain the following benefits:
The command will show what version it is
This scale to other build agents
Adds clarity to the Bamboo task (will show as dotnet 2.2 instead of a script).
Then you can have dedicated tasks for each step (e.g., restore, build, test)

Removing complete ASP.net 5 RC1 environment before moving to DOTNET Core RC2 from OSX

Recently, there is RC2 release for donet core tools. Previously, I have been using RC1 for asp.net 5. It was installed using .pkg file provided at get.asp.net.
Now, I am planning to try out dotnet core release. The instructions provided at get.asp.net ask to unistall the previous versions of dotnet core using this script.
I have 2 questions here.
Is it required to remove the RC1 release (dnvm,dnx and dnu etc) before installing dotnet core?
If it is required to uninstall, what is preferred way of doing it (something like above script) without damaging the required/shared files?
Ad 1. Yes. As you can read in ASP.NET Core installation guide:
Before you start
Remove all previous versions of .NET Core from your system.
Ad 2. In my case I just use Add/Remove programs, but it's Windows.
I have no experience with Linux, but you do not need DNX any more so no worries about required files - after a while you will install new RC2 with all required files ;)

Resources