Search code examples
c#visual-studioazure-functionsazure-functions-core-tools

Azure functions fail when creating a blank/empty project in an existing solution


I upgrade to Visual Studio 2017 15.8.1 and am having issues creating an Azure function project. The project I am trying to create is through the template wizard, just a new V1 empty function project.

I receive the following error, which seems to be .net core related.

NETSDK1004 Assets file '\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. FunctionApp1 C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 198 Run a NuGet package restore to generate this file.

But my project file states:

  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <AzureFunctionsVersion>v1</AzureFunctionsVersion>
  </PropertyGroup>

Just to be clear, I do want a 4.6.1 project, not a core one.

I have looked at other answers to this issue but none resolve it. Package reinstall, dotnet restore etc. I get more errors if I select a different template (e.g. HTTP Trigger)

Any ideas?

I thought I had a solution to reboot, then open %temp% and delete all the temporary files in that folder. Then reboot again for good measure and it worked from a blank / empty project, but as soon as I try include this in another solution or move the project it fails.


Solution

  • Seems I have it working now and I'll leave this here in case anyone else has the same.

    I did try many many things to resolve, but I believe the crux of my fix was to reboot, then open %temp% and delete all the temporary files in that folder. Then I rebooted again for good measure and it worked from a blank / empty project.