Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly - azure

I'm working in a virtual environment in VS Code and I can't understand why I'm getting this error:
[2022-07-19T10:00:31.580Z] A host error has occurred during startup operation '609dfded-e9f5-4fc4-b3a3-554bde11a415'.
[2022-07-19T10:00:31.582Z] Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')
What should I check?

Rolled back nuget package Microsoft.NET.Sdk.Functions from 4.1.3 to 4.1.1 on the Azure functions Api project.
Rebuild solution.

I had this issues as well, and my solution was to re-download and re-install the Azure Function Core Tools. I think installing twice fixed the issue for me.

This fixed it for me, hope it helps someone else
Close Visual Studio
Delete folder C:\Users***\AppData\Local\AzureFunctionsTools
Restart Visual Studio.
Launch Application, folder gets recreated.
Taken from
Unable to upgrade Azure Functions Core Tools, Exception "Cannot create instance of type 'NuGet.Versioning.VersionRange'"

We encountered a similar problem after updating Microsoft.Azure.WebJobs.Extensions.Http to 3.2.0
Developers using Rider had no problems but no Visual Studio users could run our project.
This post explained it for us: https://weblogs.asp.net/sfeldman/updating-azure-functions-tools.
Just by creating a new azure functions project, the latest version for AzureFunctionsTools was downloaded to \AppData\Local\AzureFunctionsTools.
Then we could run the project without errors.

My solution to this issue was to go into Windows Defender and exclude:
C:\Program Files\Microsoft\Azure Functions Core Tools\func.exe
I then reinstalled Azure Functions Core Tools v4 and everything worked as intended.
Ps. After excluding make sure to give time for your system to update. I restarted and all worked as intended. Hope this helps someone.

I had this exact issue until Yesterday when I tried updating Azure Function Core Tools (https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash) That resolved the problem, and I now am able to run my function's project using the CLI

For me, relaunching Azure Functions Core Tools installer and choose repair fixed the issue. I had been encountering this issue in the last two days and it's really annoying.

I believe the cause is that the Azure Functions Core Tools (henceforth AFCT) that Visual Studio (or VS Code) uses does not have the proper version of Microsoft.Azure.WebJobs.Extensions.Http.dll. Installing AFCT doesn't affect anything directly, because VS uses its own version stored elsewhere. My strategy was to install the latest AFCT version and point VS to that new version.
These instructions are for x64 Windows.
Install latest Azure Functions Core Tools
Using the below PowerShell code, move VS's old version of AFCT, then point VS to the newly installed version
Move old AFCT, point VS at new version
# Find Afct in Program Files
$PfMicrosoftPath = Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft'
$AfctPath = Join-Path -Path $PfMicrosoftPath -ChildPath 'Azure Functions Core Tools'
# Find the latest Aft in your Local AppData
$VsAftPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'AzureFunctionsTools'
$VsAftReleasePath = Join-Path -Path $VsAftPath -ChildPath 'Releases'
$VsLatestAfctPath = Get-ChildItem -Path $VsAftReleasePath | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
$VsAfctCliPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64'
$VsAfctBackupPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64_backup'
# Move the existing AFCT and create a symlink
Move-Item -Path $VsAfctCliPath -Destination $VsAfctBackupPath -Confirm:$true
New-Item -Type Junction -Path $VsAfctClipath -Target $AfctPath`

The accepted answer didn't totally fix the issue for me, but I did find that the package Microsoft.NET.Sdk.Functions(4.1.3) does cause the issue, but I found another one does as well, so it will depend on what other packages you have in your app.
So, start with downgrading that package to (4.1.1), if that doesn't fix the issue, downgrade all packages and upgrade them one by one and try running the app after each upgrade.
In my case the other package that was causing the issue along with the above package was Microsoft.Extensions.Http.Polly(7.0.0), the highest that worked for me was (6.0.11)

In my case i just executed this command in my vs code project where the tool i would use was the v4 :npm install -g azure-functions-core-tools#4 --unsafe-perm true

You can check your machine and use the latest version of azure-functions-coretools.
For those are using Rider, go to settings > tools > Azure > Functions > Upgrade your tools to latest one (the version 4.0.4785 fixed my issue).

Related

Rider doesn't see NetCore 3.0

I had used VS CODE before. But now I would like to try JetBrains Rider. Currently, I have only NetCore 3.0. But before I had 2.2. I had removed old NetCore and installed new one. I am trying to create new project. But Rider don't see NetCore 3.0.
I did not see ability to change NetCore SDK. My operation system is Linux Mint 18. I have only one NetCore version. And it's 3.0.
Why it's happening?
It is pretty common problem. I have solved it by specifying path to .Net Sdk manually. This is the screen of settings:
Specify path to .NET binary file. It is usually has the following path /home/<your_user>/dotnet/dotnet
Specify path to MSBuild file. For example my path is the next : /home/aleksej/dotnet/sdk/3.0.100-preview6-012264/MSBuild.dll
Save
Profit!
P.S. My operation system is Linux Mint 19.1. And version of .Net Core is not important in this case.
Update
I forgot about one important moment. If you need to change .NET version for your solution, you have to place special global.json file in the root of your solution. If you are changing .NET version for a project - put global.json on the project root path.
Example of global.json for changing .NET version:
{
"sdk": {
"version": "2.2.300"
}
}
If you want to find the location of your sdk then write the following command: dotnet --list-sdks. It has to show you 3.1.403 [/usr/share/dotnet/sdk] or similar to it. If it's not then consider it installed using the following guide Install .NET Core on Linux . Then select the dotnet file in .NET CORE CLI executable path, with it's respective MSBuild.dll .
PD: Remember to save the changes globally!!!.
what solved for me was remove the .idea folder and start again.
I have to use the Jetbrain MSE build
I have to do some set of things to work, due to the windows security I have some issue
On windows 11 do this
launch powershell as an admin
Set-ExecutionPolicy Unrestricted
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Set-ExecutionPolicy restricted
IGNORE THE ERRORS
on windows 10 do this
launch powershell as an admin}
run get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage
if it doesn't work do this
run Add-AppxPackage -Register -DisableDevelopmentMode "C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy\AppXManifest.xml"
run get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage
Then follow the instruction from here
https://rider-support.jetbrains.com/hc/en-us/articles/360006365380

Azure Node.js Express App scaffold.xml Missing

Am following Microsoft's "Getting Started" tutorial to deploy a Node.js Express app as a Cloud Service.
After carefully installing all the tools on two machines, one Win 7 and one Win 8, I get down to the point of generating "Hello World" and the tutorial suggests running the intuitively named: New-AzureServiceProject helloworld in Windows PowerShell.
Here is what happens:
PS C:\node> New-AzureServiceProject helloworld
New-AzureServiceProject : Could not find a part of the path 'C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\Resources\Scaffolding\General\scaffold.xml'.
At line:1 char:1
+ New-AzureServiceProject expressapp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureServiceProject], DirectoryNotFoundException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding.NewAzureServiceProjectCommand
Taking a look at my system after installing Powershell and the Azure SDK as instructed, I DO have a directory:
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile
However, that directory does NOT have a subdirectory "Resources" and hence it never finds the scaffold.xml file....
I tried creating the subdirectory Resources\Scaffolding\General inside of AzureRM.profile. That changed the error to simply "could not find scaffold.xml"
I tried setting the write positions on "General" to be wide open. No change.
The above error is on the Win 8 machine. On my Win 7 machine after digging more carefully into the install and going multiple layers deep into prereqs not mentioned in the tutorial, AzureRM.Profile ends up installed in C:\Program Files\C:\Program Files\WindowsPowerShell\Modules rather than in C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager but the behavior is identical.
I have looked all over the web and have not been able to find any information on the missing scaffold.xml that might point to a solution. Is this a template that New-AzureServiceProject needs to create the app? Or is this something that is supposed to be generated by New-AzureServiceProject?
Any suggestions would be appreciated...
Thanks!
I solved this problem by copying folder
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Resources
to
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile
Need to copy the Resources folder from:
C:\Program Files\WindowsPowerShell\Modules\Azure\3.1.0\Compute
to
C:\Program Files\WindowsPowerShell\Modules\AzureRM.profile\2.3.0\Resources\Scaffolding\General
According your error message from PowerShell, it seems that you miss installed powershell AzureRM.* modules.
Please try to run the following commands from the Windows PowerShell console running as Administrator:
PS C:\> Install-Module AzureRM
PS C:\> Install-AzureRM
Then run New-AzureServiceProject helloworld again.
Meanwhile, if you want to get started with the node.js application on Azure Web Apps, you can refer to Azure Website Cmdlets.
Apologies for the terrible experience. This looks like a bug in one particular version of Azure PowerShell. To diagnose, we would need to know which version - if you used the msi installer, or WebPI, you will find thins in the 'Uninstall a Program' control panel, the entry is 'Microsoft Azure PowerShell'.
One piece of confusion in some of the comments - the hosted service cmdlets are part of the older RDFE (Service Management) commands in Azure. The cmdlets that support these are in the 'Azure' module, and not in any of the 'AzureRM' modules.
To install the latest version, I highly encourage you to use Web Platform Installer, or the msi installer that you can retrieve from our GitHub repo. PowerShell Gallery is a great solution as well, if you are very comfortable with PowerShell module management.
I will bring this tutorial to the attention of the documentation team. Meanwhile, if you can identify the azure powershell version and the sdk version you are using, I can see if there is a fix for the problem.
Copy content from
C:\Program Files\WindowsPowerShell\Modules\Azure\4.3.1\Services\Resources\Scaffolding\General
To
C:\Program Files\WindowsPowerShell\Modules\AzureRM.profile\3.3.1\Resources\Scaffolding\General

Azure SDK 2.5.1 fails to Publish cloudService

After successfully upgrading my cloud service to the new "Azure SDK for .NET 2.5.1" I got the following error when trying packaging/publishing.
Could not load file or assembly 'Microsoft.WindowsAzure.Packaging,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file
specified. C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Windows Azure
Tools\2.5\Microsoft.WindowsAzure.targets
The related line in the "Microsoft.WindowsAzure.targets" config file is 2930 which obviously is related to CSPack.
<CSPack
ServiceDefinitionFile="#(TargetServiceDefinition)"
Output="#(PublishServicePackage)"
PackRoles="#(Roles)"
SiteMapping="#(SiteMapping)"
RoleProperties="#(RoleProperties)"
ImportedModules="#(ImportedModules)"
CopyOnly="false"
>
</CSPack>
So I went on to create a fresh new Azure Cloud service in a fresh new project to see if something went wrong with the upgrade. Unfortunately the problem persists.
Is there a workaround or will I have to rollback to v2.4 (that will cause me significant amount of pain)
I am running on VS 2013 update 4.
Sorry for the trouble, everyone. We are investigating what's causing this. It looks like there is an odd behavior with our installers where in some environments those two binaries are not installed correctly.
We did discover if the 2.5.1 Azure Authoring Tools is removed and reinstalled, the missing binaries will be installed correctly. So if you run into this issue, please remove Authoring Tools v2.5.1 from Programs and Features, and reinstall via either the Web Platform Installer or the direct download links:
http://download.microsoft.com/download/1/E/7/1E76DD6F-66F1-47E0-A76A-3BBAAC617316/MicrosoftAzureAuthoringTools-x64.msi
http://download.microsoft.com/download/1/E/7/1E76DD6F-66F1-47E0-A76A-3BBAAC617316/MicrosoftAzureAuthoringTools-x86.msi
Apologies for the inconvenience. We will continue the investigation.
I searched locally for the required dll and found it in almost all previous versions of the Azure .Net SDK had it (from v2.0 onwards I believe).
So in order to fix this you need to copy the following dlls from the previous version v2.4 of the SDK to the similar location for v2.5.
SDK installation paths.
Src location: "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.4\bin"
Dst location: "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\bin"
Dlls to copy (missing):
Microsoft.WindowsAzure.Packaging.dll
Microsoft.WindowsAzure.ServiceModel.Common.dll
Since there may be a better answer to this I will not mark this as an answer yet.

msbuild.exe location on windows 8 with VS2012

I'm trying to set up a Jenkins CI server to deploy a .NET 4.5 app but I cant for the life of me find the msbuild exe on my windows 8 machine running visual studio 2012. Any ideas?
Make sure that you have installed the corresponding .Net framework.
You can find the build.exe by following this sample path
C:\Windows\Microsoft.NET\Framework\v4.5\MSBuild.exe
The correct way to locate MSBuild is to use the registry.
Here's a powershell implementation of finding a specific version of the .exe
$regKey = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\${Version}"
$itemProperty = Get-ItemProperty $RegKey -ErrorAction SilentlyContinue
if ($itemProperty -ne $null -and $itemProperty.MSBuildToolsPath -ne $null)
{
$msBuildPath = Join-Path $itemProperty.MSBuildToolsPath -ChildPath "MsBuild.exe"
}
I do not like neither of the other answers. Because in C:\Windows\Microsoft.NET\Framework\ or registry you cannot find new msbuild version that was installed with visual studio or separately as build tools. The best way is to use vswhere
find msbuild

Windows Azure SDK v1.6 does not contain csrun.exe, where can I download?

I've downloaded and installed the official Windows Azure SDK v1.6 but for some reason csrun.exe (needed for running a package locally) is not in the bin directory with all the other exe files like cspack.exe etc. I have tried reinstalling and still did not get the executible. Is there anywhere to manually download this file, google wasn't any help...
It is installed by the new v1.6 SDK into the directory
C:\Program Files\Windows Azure Emulator\emulator
Just an update to this, looks like this is installed to the following location now.
C:\Program Files\Microsoft SDKs\Azure\Emulator
This question was prompted by my attempts to follow the post here http://blogs.msdn.com/b/brmeena/archive/2010/08/06/how-to-deploy-azure-roles-in-net-4-0-on-development-fabric.aspx about how to deploy to the dev fabric.
Andrew Patterson is correct in his answer above and I've marked it so, but I also found that I could run the tool from the Windows Azure Command Prompt even when I couldn't find the .exe (I still can't get Windows 7 search to behave)
Sharing here for my own recollection as well as to assist anyone else who might run into this issue.

Resources