Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _FunctionsSkipCleanOutput after it is no longer needed #27

Closed
bryanknox opened this issue Sep 26, 2020 · 6 comments
Closed

Remove _FunctionsSkipCleanOutput after it is no longer needed #27

bryanknox opened this issue Sep 26, 2020 · 6 comments

Comments

@bryanknox
Copy link
Owner

Remove the following line from the SampleFunctionApp.csproj file once that workaround is no longer needed.

<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

That project property was added as a workaround related to upgrading the NuGet packages in the solution.
See issue #24 and PR #25.

The _FunctionsSkipCleanOutput project property is not (currently) documented. But it is, "completely safe and will continue to be supported", according to:
Azure/azure-functions-vs-build-sdk#397 (comment)

It is not yet clear when the _FunctionsSkipCleanOutput project property will no longer be needed.

@aaronhudon
Copy link

DON'T REMOVE THIS until you've fixed this:
Azure/azure-functions-host#7061

@bryanknox
Copy link
Owner Author

bryanknox commented Jul 18, 2021

My current understanding of the issue it that Azure Function build tools will remove assemblies (.dll files) that have the same name of those that are also used by the functions run-time. This is done as an optimization. Unfortunately, assemblies are removed even if they are newer versions.
See: https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs#configure-your-build-output-settings

The _FunctionsSkipCleanOutput element has been around since Azure Functions v 1.x. It is a rather brute force, don't clean out any assemblies with the same names, approach.
See MicrosoftDocs/azure-docs@438b9fb
It is undocumented but sometimes recommended. For example see:
Azure/azure-functions-vs-build-sdk#397

The new FunctionsPreservedDependencies where introduced in Microsoft.NET.Sdk.Functions 3.0.12 and minimally documented. It requires devs to list the specific assemblies they don't want removed.
See https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs#configure-your-build-output-settings

A FunctionsSkipCleanOutput element has been proposed but not yet accepted. It would be a public, and documented replacement of the _FunctionsSkipCleanOutput element.
See MicrosoftDocs/azure-docs#77460

There is a list of assemblies that the functions run-time uses. That list is maintained at:
https://github.com/Azure/azure-functions-host/blob/dev/tools/ExtensionsMetadataGenerator/test/ExtensionsMetadataGeneratorTests/ExistingRuntimeAssemblies.txt

A dev/devops team might decide between skip cleanout and preserving specific assemblies base on the amount of efficiency they desired in the run-time environments for their function app.

  • _FunctionsSkipCleanOutput - Skip cleanout if efficiency loss due to multiple assemblies being deployed is not a concern. Skipping cleanout doesn't require additional potential maintenance over time.
  • FunctionsPreservedDependencies - Preserve dependencies if efficiency is important, and worth the cost of the updating the FunctionsPreservedDependencies elements as the functions run time and the function app evolve.

See Azure/azure-functions-host#6849 (comment)

@bryanknox
Copy link
Owner Author

bryanknox commented Jul 12, 2022

It looks like the FunctionsPreservedDependencies project property is no longer documented at:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs#configure-your-build-output-settings

The "Configure your build output settings" section, where it was mentioned, has been removed. Sad.

Currently, as far as I can tell, both the FunctionsPreservedDependencies and _FunctionsSkipCleanOutput project properties are undocumented by Microsoft. Although very necessary for development of in-process Azure Functions.

@bryanknox
Copy link
Owner Author

I'm closing this issue. It seems that the use of either _FunctionsSkipCleanOutput or FunctionsPreservedDependencies will continue to be necessary for in-process Azure Functions.

@bryanknox
Copy link
Owner Author

I wrote a blog post: _FunctionsSkipCleanOutput and FunctionsPreservedDependencies.

Since there are no official docs, it at least captures what I've learned about resolving "Could not load file or assembly" errors in in-process Azure Functions.

@OlegGlushko
Copy link

Want to add that in my Azure function v3 under netcore 3.1, having references to other net472 projects, my entity framework completely blew itself up. Every single entity that had [Key] data annotation remapping from default "built-in" one was causing runtime errors.

EntityType 'myEntity' has no key defined. Define the key for this EntityType. even though I had the [Key] annotation and this code has been working for years.

After removing
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
The error went away immediately. Although, I am now still in DLL hell at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants