Azure-functions-vs-build-sdk: Azure Functions Build & Publish do not include all dependencies correctly

Created on 14 Mar 2019  ·  12Comments  ·  Source: Azure/azure-functions-vs-build-sdk

_From @cloudlene on November 2, 2018 5:45_

  1. I have a .Net Standard assembly (Let's call it Cloudlene.Rhipheus.dll)
  2. It depends on an appSettings.json. It's marked 'Copy Always'
  3. I have few .Net Core projects that depend on this assembly (Let's call it Cloudlene.MyProject.Api.dll)
  4. When I build the Cloudlene.MyProject.API, the output folder ('bin\debug') contains all 3 files

Switch over to Azure Functions

  1. Function project depends on the same assembly: Cloudlene.Rhipheus.dll
  2. I build the function project
  3. The dll is copied to bin\debug\netstandard2.0\bin correctly
  4. The appSettings.json, though is copied to the netstandard folder!
  5. So, I go ahead and add a Post build event to move this file to bin

Now, I'm able to 'func start' from command line.

Publishing time!

  1. I use VS.Net to publish to my dev subscription. Right click & Publish
  2. I have a valid publish profile & all other steps to connect to Azure work as intended
  3. As soon as I hit 'publish', Function project creates a 'PubTmp\Out' folder & I see it's updating my appSettings to the root of the function folder (Meaning assembly is copied to myfuncproject\bin\ but the appSettings.json is copied to myfuncproject)
  4. I login to Azure, login to the console under Platform features tab
  5. I see the file is in the root AND not inside the bin folder!
  6. I run move command to move the file to bin
  7. Restarting the function to run without exceptions

This is vexing. What are my options?

_Copied from original issue: Azure/Azure-Functions#1017_

Most helpful comment

@cloudlene - the original publish issue is already fixed. The only remaining known item that I know of is the issue that I linked.

Devs can use this property to bypass the auto-skimming of the output folder.

<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

All 12 comments

_From @nimakms on November 9, 2018 21:16_

@cloudlene, apologies for the late response. We'll be tracking this with the Visual Studio team, but I don't imagine it will be a quick fix. I'm glad you have already figured out the issue and mitigated it with workaround steps (post-build event, move command on deploy). In the short term that is still your best bet.

_From @cloudlene on November 13, 2018 14:37_

No it is not, unfortunately. We need to get this to work with Azure
DevOps. For that the build & deploy should function as expected. We can't
use this in production, if our deployment have to be manually tweaked after
publication. Any workarounds? Is there a way to automate the move
commands to Azure function console after publication?

On Fri, Nov 9, 2018 at 4:16 PM Nima Kamoosi notifications@github.com
wrote:

@cloudlene https://github.com/cloudlene, apologies for the late
response. We'll be tracking this with the Visual Studio team, but I don't
imagine it will be a quick fix. I'm glad you have already figured out the
issue and mitigated it with workaround steps (post-build event, move
command on deploy). In the short term that is still your best bet.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/Azure-Functions/issues/1017#issuecomment-437497603,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA9_GvThX6RTSr0B5pJvZyynnXc19s_qks5utfCZgaJpZM4YLEQi
.

_From @dejanberic on January 22, 2019 14:22_

I have the same problem.
I even tried to copy on post-build event to the PubTmp\Out but that folder is emptied after I copy the files I need, So that is a no go.
Is the a pre-publish event of some sorts?

_From @penguin20000 on March 14, 2019 14:15_

Is there any update on this issue? I'm having the same issue as @dejanberic and @cloudlene

As a workaround for folks in the other issue in your .csproj you can add something like this,

  <!--https://github.com/Azure/azure-functions-vs-build-sdk/issues/298-->
  <!--Functions build targets won't copy zip files over to the bin folder on build-->
  <Target Name="CopyFilesAfterBuild" AfterTargets="AfterBuild">
    <Copy SourceFiles="$(OutDir)file.txt" DestinationFolder="$(OutDir)\bin\"/>
  </Target>

   <!--Functions build targets won't copy zip files over to the bin folder on pack/publish-->
  <Target Name="CopyFilesAfterPublish" AfterTargets="AfterPublish">
    <Copy SourceFiles="$(OutDir)file.txt" DestinationFolder="$(PublishDir)\bin\" />
  </Target>

There is probably a shorter msbuild-y way to do this but this is effectively what you need to happen.

Do we have a solution for this problem yet ?
I have created a file called appconfig.settings.json and reading the configuration at run time. After publishing I am unable to see the this file anywhere in functionApp in azure

I have encourered the same issue. I have build an Azure Function with dotnet core 3.1, my dependencies are on .net standard 2.1 and built an CI/CD to host it on Azure and all half of the dependencies are missing. What's the status on this issue? it was created on March 2019, a year later and no fix?
I had to rollback to dotnet core 2.2 for my Azure functions. Please fix this.

HI Folks, I have exactly the same issue

  • .NET Standard 2.1 projects
  • .NET 3.1 libraries
  • 3.1 Azure functions which reference the Standard 2.1 & 3.1 projects

When I build or publish I am missing DLL's that should be there in the output folder.
I need to manually copy some DLL's into the bin folder as the function runtime is starting up to get them to work even in a development environment.

  • For one of them the function runtime won't even start up , it's says "missing Microsoft.Extensions.DependencyInjection.Abstractions"

This is a right pain in the behind, I'm not sure what to do next.

  • Rollback to Azure Functions 2.0
  • Rollback to ,NET 2.2
  • -

or

  • Attempt to move everyint to .NETCore 3.0, including standard projects.

Either way I've wasted a whole weekend struggling with this problem to no avail.

Sounds like it might be the same issue? https://github.com/Azure/azure-functions-vs-build-sdk/issues/397#issuecomment-596315129

@vijayrkn Not sure how this issue is a “dupe” of the the linked “feature”. This issue was raised first in 2018. @brettsam Could you comment on whether your implementation would address this issue?

@cloudlene - the original publish issue is already fixed. The only remaining known item that I know of is the issue that I linked.

Devs can use this property to bypass the auto-skimming of the output folder.

<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

Was this page helpful?
0 / 5 - 0 ratings