Azure / azure-functions-vs-build-sdk

MSBuild task for Azure Functions
MIT License
99 stars 66 forks source link

dotnet build on Azure Function project results in unexpected output in bin folder #299

Open livarcocc opened 5 years ago

livarcocc commented 5 years ago

@Royhoey who is the original reporter of this bug.

Since a couple of days ago I am running into some problems when trying to build and publish my Azure Function on a buildserver. When I build and publish my function on my local machine, it works fine but on the build server I get a different result. I've tried different versions of the .NET SDK but that does not seem to matter. Any ideas?

Steps to reproduce

Expected behavior

Folder with bin folder like this (this is the expected result I get on my local machine): functions2

Actual behavior

Folder with minimal files like this (this is the output on the build server): functions1

Environment data

dotnet --info output:

Version: 2.2.103 Commit: 8edbc2570a

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.103\

Host (useful for support): Version: 2.2.2 Commit: a4fd7b2c84

.NET Core SDKs installed: 1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk] 1.0.0-preview2.1-003155 [C:\Program Files\dotnet\sdk] 1.0.0 [C:\Program Files\dotnet\sdk] 1.1.0 [C:\Program Files\dotnet\sdk] 2.0.0 [C:\Program Files\dotnet\sdk] 2.1.201 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk] 2.2.101 [C:\Program Files\dotnet\sdk] 2.2.103 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.0-preview1-001100-00 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Project File

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <ProjectGuid>27415456-5db4-49ec-91d7-acb9303c6dec</ProjectGuid>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="IdentityModel" Version="3.10.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.0.0-preview1-10002" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.*" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

This seems like a specific change done by the azure functions SDK, so I moved the issue here.

The original issue is here: https://github.com/dotnet/cli/issues/10827

benPearce1 commented 4 years ago

I started getting this exact issue after upgrading Microsoft.NET.Sdk.Functions from 1.0.29 to 1.0.31. Suspect if might be this PR https://github.com/Azure/azure-functions-vs-build-sdk/pull/361