I can't run/debug Azure Function project in VS2017 using Windows 10 Enterprise - azure

Whenever i try to run/debug an Azure Function project in Visual Studio 2017 i get an error stating that i need .Net Framework 4.7.1 (which i can't install due to have preinstalled windows 10 Enterprise in my working machine by company policy),I'm using Azure Functions and Web Tools Extension version 15.0.40608.0, anyone can help me with a workaround on this matter ?

If you got exactly this error message
The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. ...
You can try to change your target framework to a version you have installed, like the error suggests.
Right click on your project, Edit FunctionProjectName.csproj, find <TargetFramework>net471</TargetFramework>, change it to the version installed, like net461.
If you can't run this project correctly on lower version of .Net Framework, as rickvdbosch says, it might be required to update your Windows and install the SDK or modify your code to make it compatible on lower version.

Related

Install Azure Functions version 1

I am required to write an Azure Function, with HTTP triggers. My problem is, when I choose Azure Functions template in Visual Studio 2017, it just creates an empty project with two files, host.json and local.setting.json, which makes me believe that I have version 2 of the Azure Functions installed.
When I try and compile this version of the Azure Functions I have installed, I get a message saying that I need .Net Frameworik 4.7.2 installed, and I cannot install this framework version on my Windows 10 version.
How can I downgrade or install the Azure Functions version 1?
My Environment:
Windows 10 (Build 10240)
Visual Studio 2017 Professional (version 15.5.4)
Any help?
I recommend you to update your Visual Studio 2017 to 15.8.1 if possible.
15.5.4 seems too old and doesn't work with latest Azure Functions and Web Jobs Tools.
Many templates support in latest Azure function extension.
While you are creating a new Azure Functions project in Visual Studio, you get asked which version (v1 or v2) you want. The structure of the project (the two files you mention) are the same for both versions.
The difference is that v1 is targeting full .NET Framework 4.6+, while v2 is targeting .NET Standard 2.x.
I've just tried with VS 15.8 and v1 project template is targeting 4.6.1 by default, so this version should be enough.
You can try to create function app from command line using func command. To install CLI I recommend use of chocolatey and simply type choco install azure-functions-core-tools.

How do I upgrade an existing Cloud Service Project to use Azure SDK 3.0?

I'm migrating from VS2015 to VS2017, and updating a repo's solutions to be able to be compatible with VS2017. In the process, I'm also updating the Azure SDK version from 2.7 to 3.0.
I'm setting up a fresh dev environment, and installed Azure SDK 3.0 via VS2017's Azure development workload.
When I opened the solution file in the repo, I got one notice per cloud service project that its Microsoft Azure Tools version was getting upgraded from 2.7 to 2.9...
...and the ProductVersion tag in the corresponding .csproj files was updated from 2.7 to 2.9.
Questions:
Why wasn't this updated to 3.0?
Is there anyway for me to update it
to 3.0 without manually editing the csproj file? I don't see an
option to do so in Properties when I right click the cloud service
projects in Solution Explorer.
Is there some reason I shouldn't be
doing this?
"Microsoft Azure Tools - v2.9" mentioned in your screenshot is just a little misleading.
Underlying reason is that Microsoft hasn't really changed the version number of most components as part of 3.0 SDK release. Even the binaries get installed in the same folder as 2.9.
Good news is that you don't need to do anything special apart from converting the project to target latest version, which you're already getting prompted for.
So once you do convert your project as per the prompt, you're essentially working with SDK 3.0, even though version string says v2.9, because as the links explain, most of the components haven't changed major version number as part of SDK 3.0 version (when comparing with 2.9)
Here are some of the links which talk about this -
Azure SDK for .NET 3.0 Release Summary
No breaking changes to the Azure SDK 3.0 have been introduced in this
release. There is also no upgrade process needed to leverage this SDK
with existing Cloud Service projects. To allow use of the Azure SDK
3.0 without requiring an upgrade process, Azure SDK 3.0 installs to the same directories as Azure SDK 2.9. Most the components did not
change the major version from 2.9 but instead just updated the build
number.
Visual Studio 2017 latest installer does not install Azure SDK 3.0
In this link look at the response from Devin Breshears - MSFT
Azure 3.0 SDK Install Weirdness
An independent blog talking about the same issue.

Running Azure functions will result in .net 4.7.1 installation prompt dialog

When I try to run (debug) functions in Visual Studio 2017 on one of our machines, the following dialog pops up!
The target framework for the project is <TargetFramework>net461</TargetFramework>. For some reasons I am not able to install .NET 4.7.1 and now I am completely lost. I am sure it was functioning in the past on the same machine. Probably one of the updates caused it.
Any idea how to resolve it?
This is because the latest version of the Azure Functions Tools for Visual Studio now requires .NET Framework 4.7.1 (as of February 2018).
Note that this does not impact the target framework that you compile against - only the target framework your code runs against. Similarly, when you run in Azure, you can expect the .NET runtime version to be .NET Framework 4.7.1 (at the time of writing).
I tried implementing the solution mentioned in comment. However, it didn't work for me. However, reverting the Azure Functions Tools to previous version worked. Thanks Chris for pointing that it was Azure Tools and not any packages that caused it.
If anyone else should come across this.
For me, the issue was the actual func.exe config that needed to be upgraded.
Navigate to:
C:\Users[USER]\AppData\Local\AzureFunctionsTools\Releases[VERSION]\cli
.. my version was 1.4.0
Modify the func.exe.config to match the .net version installed
.. it was 4.7.1

ASPNETCoreModule not installed with .NET Core SDK

I installed VS 2017 along with .NET Core SDK on Windows 10. But it did not install ASPNETCoreModule as shown in figure 2 below. I thought .NET Core SDK should have installed it implicitly - and one does not have to install it separately. NOTE: I'm trying to publish my asp.net core app to IIS and the publish process requires ASPNETCoreModule as explained in the above link and also in this official MSDN article.
ASPNETCoreModule is missing:
ASP.NET Core Module is installed separately from the SDK. You can download the current version 2.0.0 here. https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md#windows-server-hosting
See https://github.com/dotnet/core/blob/master/release-notes/download-archive.md for a list of other releases.
ASP.NET Core Module is installed separately from the SDK
It's not true since the release of 2.1. I'm experiencing the same issue on Windows Server 2016. The module was installed on developer PC after uninstalling old versions / installing 2.1 a few times, but still struggling with the same issue in 2016. %SystemRoot%\system32\inetsrv\aspnetcore.dll is still missing.
In order to run .net core apps on IIS you need to have installed the ASP.NET Core Module ( the way it works is explained here ) that comes:
1 - with the SDK 2.1,
2 - With the Hosting Bundle Installer that bundles the .Net Core and the ASP.NET Core Runtime into a single bundler.
you can have both from the download page
If you are a developer computer you already have the Module with the SDK, I think is better to have on Sever computer only the hosting bundle
First, you need to check your IIS configurations, in case Shared configuration is configured in your IIS then normal installation of dotnet hosting bundle package wont work,
to make it work you need to install bundle package by command line with the argument as below:
dotnet-hosting-{VERSION}.exe OPT_NO_SHARED_CONFIG_CHECK=1
you can refer ASP.NET Core Module with an IIS Shared Configuration
This solution work for me because we are using the shared configuration in IIS

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

Resources