I am very new - trying to build hello world azure function in vs code ide. When I am trying to test it localy I am getting these errors:
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : You must install or update .NET to run this application. [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : App: /Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/tools/netcoreapp3.1/Microsoft.NET.Sdk.Functions.Generator.dll [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Architecture: arm64 [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Framework: 'Microsoft.NETCore.App', version '3.1.0' (arm64) [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : .NET location: /usr/local/share/dotnet/ [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The following frameworks were found: [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : 6.0.12 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Learn about framework resolution: [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : https://aka.ms/dotnet/app-launch-failed [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : To install missing framework, download: [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=arm64&rid=osx.13-arm64 [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
/Users/<username>/.nuget/packages/microsoft.net.sdk.functions/3.0.10/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Metadata generation failed. [/Users/<username>/Library/CloudStorage/OneDrive-<companyName>/ConsentizerSandbox/sand-generateUserGuid/sand-generateUserGuid.csproj]
I tried:
- reseting workspace
- physically checking the nuget packages
- dotnet restore
- .net reinstall
- dotnet runtimes / sdks
and probably other things laying on the internet. without any luck. Build is ok, after build Azure extensions take over and return these errors.
the script is easy:
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Consentizer.guid
{
public static class helloWorlFc
{
[FunctionName("helloWorld")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
string responseMessage = string.IsNullOrEmpty(name)
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
: $"Hello, {name}. This HTTP triggered function executed successfully.";
return new OkObjectResult(responseMessage);
}
}
}
Can you please give the kick in the right direction please? How to solve it in order to be able to locally tested and deployed to azure through vs code azure extension?


