Build works locally and fails in Azure - azure

I have a project in C Sharp which build correctly in my local machine ( as well as in the one from my colleagues ). But when we try to configure the pipeline in Azure, in the step of Nuget restore everything stops and we get an error message stating that package "A" is not compatible with netcore 2.2, as well as package B,C,D,etc.
Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.

Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.
This error can occur with an outdated version of nuget. The default version of NuGet running in the VSTS pipeline was not the latest one.
So, to resolve this issue, there is a nuget version installer task which you can run as part of your build step to upgrade the version of nuget running in your build pipeline:
Besides, if update nuget version not resolve this issue, please check the SDK version on the build agent is same as your local, you can use the task Use .NET Core to update the SDK version.
Hope this helps.

Related

Upgrading Aspnet Core application on linux gives Error

I am trying to upgrade an Asp.net core application on Debian vm. After I copy the new dlls and test with dotnet path-to-my-app.dll I get this error.
LTTng-UST: Error (-17) while registering tracepoint probe. Duplicate registration of tracepoint probes having the same name is not allowed.
Two further clarify, I am upgrading a self contained app. I first stop the running service and then replace the files with new ones and then just do a
dotnet path-to-myapp.dll
and the above error appears. There was no change in appsettings or any other configuration changes. Do I need to stop any other services as well?
For the general public here is the issue and the solution:
The version on my linux VM was 2.1.5 and my App target version was 2.1.0, However the previous target framework version of installed app was 2.1.0 and it was working fine. I only made a few changes and went on to deploy the new version, first it failed to build with the command "dotnet build --runtime linux-x64" complaining about different frameworks to restore and build. So I first changed the project file to use
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
And after that it failed to run with the above error. Finally I changed the RuntimeFrameworkVersion to 2.1.5 to match my host version AND didn't use the "dotnet build --runtime linux-x64" command but Publish instead. I also read about using the Publish command here:
https://codeblog.dotsandbrackets.com/package-downgrade-issue/

Azure Functions - Referencing the same library as the CLI

I'm working on a precompiled C# Azure Function, and I want to reference a lot of the Microsoft.Extensions dlls. The current version is 2.1.1 for most of these.
However, when I run the project, I get an assembly load error. This seems to be caused by the folder the func.exe file is in comes with most of these dlls, but at version 2.0.0.
If I reference version 2.0.0, then everything works. But is there a way to not have to reference the exact same version as the cli?
This version conflict has been fixed in new version cli. See this related issue and SO thread.
This should be resolved on the latest version of the Azure Functions runtime (2.0.11888, CLI 2.0.1-beta.31).
Have done some tests with Microsoft.Extensions.Configuration 2.1.1. Works as expected.
To consume the latest cli,
If you use Visual Studio to debug,
update Azure Functions and Web Jobs Tools(in menu Tools>Extensions and Updates) to latest version 15.0.40617.0. After update, create a new Azure Function project, wait at the create dialog for VS to download new cli and template.
After a while, we can see the tip change to
On Windows, check whether this folder%LocalAPPDATA%\AzureFunctionsTools\Releases\2.2.2exists, which contains 2.0.1-beta.31 cli. If the downloading fails, just delete %LocalAPPDATA%\AzureFunctionsTools folder and restart VS to download again.
If you use npm, npm i -g azure-functions-core-tools#core --unsafe-perm true. For more choices, see cli installation.

ASP.NET Core app build to target Core 2.1 fails on IIS 10 server where Core 2.1 is installed

I have just setup up IIS 10 on a clean Server 2016 hosted server, and installed the following packages that I have gleaned should be on the machine to allow IIS to host ASP.NET Core applications:
aspnetcore-runtime-2.1.0-win-x64.exe
dotnet-hosting-2.1.0-win.exe
dotnet-runtime-2.1.0-win-x64.exe
I have installed my app straight into the Default Web Site and replaced all files in C:\inetpub\wwwroot\ with my app files. I also did assign the web site an app pool with no managed code, so that isn't my problem.
Last time my app was built with 2.0, and I installed the latest versions of the above packages, which I'm sure was 2.0, and the only error I had was that the command dotnet that IIS uses to invoke Kestrel to run the site, was not in the PATH env. variable
Now when I try and browse to localhost on the Server 2016 machine, it gives me the following error, found in the Windows event log:
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical
root 'C:\inetpub\wwwroot\' failed to start process with commandline
'dotnet .\QuickDrive.Mvc.dll', ErrorCode = '0x80004005 : 8000808c.
Initially I tried with the same build as before, which was 2.0, and when I got this error, I rebuilt the app to target 2.1. Nearly every search result and relevant SO answer I can find suggest a version conflict, but now there should at least be no version conflict between the runtime and hosting package on the server. Maybe there are other version conflicts I am not aware of though?
At very least I'm asking for some advice on how to get more detailed diagnostic information, even if I don't get an answer that tells me straight what config options and versions to check on Windows and on IIS.
You have to install the Core SDK for whatever version you want to target in Visual Studio. Installing the runtime alone won't do the trick. You may have the restart Visual Studio afterward to see it in the list.
Here is a link to the SDK 2.1 download (the latest as of this writing).
I solved the problem by running dotnet myWesite.dll in PowerShell, and first I found that dotnet.exe was not in the PATH environment variable, and after fixing that, running dotnet myWesite.dll again gave me a meaningful error message that an assembly was missing because it had not been included when I published the website.
I faced the same error on the dev machine in IIS Express. MVC App stopped working all of the sudden. Eventlog gave the 0x80004005 error code.
After trying multiple suggestions, the solution to debug the wired error code was to run the app in the console:
[Project bin folder]> dotnet [projectname].dll
It appeared that during the NuGet package update, the dotnet core version was accidentally updated to 2.1.4 where as the installed version was 2.1.3
[could be a bug in Nuget manager as the update was from there]
I edited the project file to reference the available version (2.1.3) and the app started to work properly.

How to update .NET Core on Azure Web App?

I have my Azure Web App configured to deploy from a local git repository - I just push my changes to the Web App git repo and it builds and deploys the site.
I just updated to my ASP .NET Core site to: "version": "1.0.0-preview2-003133", previously it was 003131 which worked no problems.
I now get the response when doing the git push:
remote: GETSDKTOOLINGINFO : error : The project is configured to use .NET Core SDK version 1.0.0-preview2-003133 which is not installed or cannot be found under the path D:\Program Files (x86)\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
I would prefer to update the .NET Core version on my Web App than downgrade, but how?
In case you are wonder how I have 3133 already: https://github.com/aspnet/Tooling/issues/801
You basically can not update the dotnet version on Azure. Currently the version of dotnet that is running is 003131. So you still have to use the previous version.
How are you building your release package?
I had this yesterday using a VSTS build process, when using the 'Visual Studio' build task it will fail with this error currently - changing your process to use the "CMD line" build task and "dotnet publish" allows the build to complete successfully.

Nuget 3.0 error on azure deployment

I have a VS2015 project that I have successfully deployed on Azure (via Github) as a web app.
However, after some offline updates, when I deploy, i get the error
The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60717.93'."
Is nuget 3.0 installed on the web app servers? And how can I use it?
I ended up reverting the System.Net.Http 4.0.0 package to an older version, that works with NuGet version 2.8.60717.93.
NuGet doesn't go on the the app server, it goes on the build server. Make sure your build server has the latest NuGet client. See this SO Answer.

Resources