Azure functions not showing under "Add new item" in visual studio 2022 - azure

I'm learning Azure functions, and after setting up an initial project the tutorial suggests to select Project > Add new Item > Azure function.
On my end, I don't see Add New Item in the menu, but if I right click on the .csproj file I see add new item, however, I don't see an option for adding an azure function.
Expected behavior (screenshot from tutorial)
Actual behavior on my end:
I checked this post where it says to add "Azure Functions and web job tools" though I don't see that as an option on my side.
Also referenced this post:
Missing Azure functions template under Add new item in Visual Studio
It recommended making sure I have the Azure SDK workload (which I do) and installing this SDK: Microsoft.Net.Sdk.Functions
I went to my folder and ran this command so as far as I know it's installed at this point.
dotnet add package Microsoft.NET.Sdk.Functions --version 4.1.3
This is my current file structure and .csproj file.
When setting up VS, I selected Azure SDK as a workload. Also, if I go to File > New > Project, I have an option for Azure functions.
Any insight as to why it's not showing up for me would be appreciated. If you need me to clarify anything, please let me know.

As you have followed one of my practical workarounds #7004818, make sure you have done the below configuration:
Download & Install the Azure Functions Core Tools, VS 2022 Current Version 17.4.4
In Visual Studio installer, Select the below options:
- Web & Cloud: ASP .NET & Web development, Azure Development
- Desktop & Mobile: .NET Desktop development
- Other toolsets: Visual Studio Extension Development
You are developing the Azure Functions in .NET So, install the respective Version SDK & Runtime.
On the Same above Post, the user #GraceA added a point to my answer which is to check the NuGet Package Source Install/Update is missing and there are steps given in the answer for updating/installing it.
[VS NuGet Package Update Gif Image1]
[VS Azure Functions Toolset Update Gif Image 2]
The Same issue registered on MS Q&A Forum #386611 where the user has resolved it by updating the NuGet Package Source.

Related

Can't change Runtime-stack version in Distribution center

I can't choose runtime-stack version when I try to set up GitHub as source in Azure Distribution center:
Version 3.1 is the only available option. My app references ASP.NET Core 6 and targets .NET 6 so when I run the Workflow in GitHub to test the build fails. I can easily change from
dotnet-version: '3.1.301'
to
dotnet-version: '6.0.x'
in the created workflow file created by Azure.
My question is why can't I choose version in Azure portal?
AFAIK you cannot change Version over there. Alternatively, If you want to change the Runtime Stack version, you can change by following below workaround:
Firstly open your app
Then click on Configuration in Settings
Then on General Setting
Then on .Net Version to change to required version

using Microsoft.Azure.Cosmos.Table doesn't work in a UWP project

We are creating an HoloLens 2 app.
Our installed NuGet packages are:
Hyak.Common
Microsoft.Azure.Common
Microsoft.Azure.Cosmos.Table
Microsoft.Azure.DocumentDB.Core
We want to use the library "Microsoft.Azure.Cosmos.Table" for our Azure Storage Account table storage.
We are working with Unity 2018.4.22f1 and Visual Studio 2019. When we try to use Microsoft.Azure.Cosmos.Table we get this error:
The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Everytime we reinstall the nuget "Microsoft.Azure.Cosmos.Table" it works at first. When we restart visual studio 2019 the error appears again
using Microsoft.Azure.Cosmos.Table doesn't work in a UWP project
Please try the following steps:
1) disable any third party extensions under Extensions--> Manage Extensions in case some extensions cause this and after that, you should restart VS
2) delete all component caches under C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache
3) clean all nuget caches, delete bin and obj folder and then restart your project.
4) try to create a new project and then install these four nuget packages to test whether this strange behavior appears in the new project.
Or you could create a new project to migrate your old project into the new project to test whether the issue still persists.
If still faces the same error, please try step 5
5) repair vs in vs installer or if there is any update for VS, please update it.
Update
=============================
After a deep research, I think the issue is that your uwp project's target version is not compatible with that package's version.
So the solution is that you should
set the uwp project min target to >=Windows 10 Fall Createors Update(10.0;Build 16299) and target version >=Windows 10,version 1809(10.0,Build 17763).
Also, use the latest nuget package Microsoft.Azure.Cosmos.Table 1.0.7 version

Azure Mobile Services - System.PlatformNotSupportedException

i'm working on a xamarin forms app with azure however when I load my initial page it crashes on the line:
public static MobileServiceClient MobileService =
new MobileServiceClient(
"https://myapp.azurewebsites.net");
with exception:
System.PlatformNotSupportedException "The empty PCL implementation for
Microsoft Azure Mobile Services was loaded. Ensure you have added
nuget package to each of your platform projects."
How do I fix this?
It might mean that the NuGet packages did not install correctly in one of your platforms. I would suggest doing a force-reinstall of all NuGet packages using the Package Manager Console (Tools/NuGet Package Manager/Package Manager Console).
Update-Package -reinstall
Do this for all projects in your solution. Once done, close and reopen Visual Studio, open your solution and click Build in the top menu and do Clean Solution.
Now look into each of your platform projects in turn to see if you have a Microsoft.Azure.Mobile.Client reference there:
If it is not there, install the Microsoft.Azure.Mobile.Client package again in that given project.
Then you should proceed as described in any tutorial on Azure Mobile Services. Even if you use the Shared Project strategy in you Xamarin.Forms app, it should work as expected once the platform project has Microsoft.Azure.Mobile.Client installed.
If it does not help, as the last resort I would suggest trying to update all NuGet packages to their last version (right-click solution, Manage NuGet Packages for Solution...)
Make sure that you add the initialization code in the respective AppDelegate/MainActivity
CurrentPlatform.Init();
And that in the iOS, Android and PCL projects there is the reference to the Microsoft.Azure.Mobile.Client package.
Example
It instantiates the MobileServiceClient in the TodoItemManager class.

Type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure'

I'm working with a pre-existing codebase from a software developer that has left my company. I've downloaded the source code from the repository. When I attempt to build the project, I get an error that says:
The type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?)
I can't figure out how to get this project up-and-running. When I look at the NuGet packages associated with the project, I can see that the Windows Azure Configuration Manager and Windows Azure Storage packages are already installed. I'm not sure what I'm missing though.
Can someone tell me what I need to install on my machine to get past this error? Thanks!
I recently had this error. The problem was that the project was referencing Framework 3.5 and I have the 2.4 SDK installed which targets 4.0. Upgrade your project to target 4.0 and you should be fine.
I was getting this error on Visual Studio 2015 Update 3. This project's Azure Tools verion is 2.9.
I resolved this error by right clicking References under the project that has the error, then clicking Add Reference, then click Extensions under Assemblies. Find Microsoft.WindowsAzure.Diagnostics, check the box, and click OK. Now try rebuilding your project and hope for a different error.
The assembly should exist on your computer here: C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\plugins\Diagnostics\Microsoft.WindowsAzure.Diagnostics.dll
If you do not see this assembly, it's most likely because you do not have the required Azure SDK. If you are using Azure SDK v2.9 like I am, you can download the SDKs here: Microsoft Azure SDK for .NET - 2.9
Then click download and select:
MicrosoftAzureLibsForNet-x64.msi (Microsoft Azure Client Libraries for .NET)
MicrosoftAzureTools.VS.140 (Microsoft Azure Tools for Microsoft Visual Studio 2015)
If you are using Azure SDK v2.7 then you will want to use this link: Microsoft Azure SDK for .NET - 2.7

Unable to deploy Orchard Azure project - YSOD fresh off sources

I am deploying Orchard to Azure cloud services (webrole) without any code changes to the official stable release. However, when I navigate to that freshly deployed Orchard cloud service (webrole), I see a YSOD with Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
As a work around, if I enable Local Copy=True (i.e. modify source), then this specific YSOD goes but is replaced by another one for msshrtmi). But more importantly, I'm able to deploy the pre-built downloaded Orchard Azure (1.7, prebuilt off same GIT src tag), without issues, so I'd rather fix the root issue than go down a rabbit hole of workarounds and drift further from the official sources.
How I'm running into this issue:
Download source from GIT (http://orchard.codeplex.com/SourceControl/latest, I used commit 5e0c26f73cf5, )
Run ClickToBuildAzurePackage.cmd script
Edit buildazure\Stage\ServiceConfiguration.cscfg to put in connection string's to point to the real Azure storage account (vs Local Storage).
Deploy both the files in buildazure\Stage to Azure via the windowsazure.com portal
Navigate to site (eg: http://OrchardTest.cloudapp.net)
Enjoy the yellow-screen-of-death :(
Our local build system:
Windows 8, x64
VS2012.3
Azure SDK 1.7, 1.8, 2.0
Question:
Has anyone deployed to Azure successfully? Any ideas how to resolve this issue?
There should never be a need to CopyLocal True on the Azure Service Runtime. That is automatically included in the package, defined by your Cloud Services project (In this case, Orchard.Azure.CloudService). And actually, I could imagine that CopyLocal True might cause issues if the bin contains a different version of the Service Runtime than the Azure package was built under.
Orchard Azure uses the Azure 2.0 libraries. It shows that you have the 2.0 SDK installed because you can compile the Orchard.Azure.CloudService project to make a package. Cloud Service projects have different a project guid for each version of the Azure tools, so without the v2.0 SDK, it would be an unknown project type. However, with your Orchard website picking up ServiceRuntime v1.7, it seems that something is amiss with your local environment, as it should still identify with v2.0.
When you open Orchard.Azure.sln, check the Properties on the Microsoft.WindowsAzure.ServiceRuntime reference within the Orchard.Azure.Web project. What is the version that Visual Studio lists on that reference? It should be 2.0.0. If it does not, my best recommendation would be to reinstall the 2.0 Libraries.
The deployment steps as you have defined work just fine with no YSOD. I successfully tried it just before writing this; it did not reproduce your issue.

Resources