3

We have an Azure Function project that contains a specifically named file that makes local debugging much easier. However we do not want that file to ever be deployed to Azure.

The standard package and publish process explicitly knows about the file named local.settings.json so that file is never deployed.

Some online docs and posts say that you can include a file in your project called .funcignore that has the same syntax as .gitignore. In there you should be able to specify files you do not want packaged.

The file we have is called local.funcdebugging.json and has the file properties of

  • Build Action: None
  • Copy to Output Dir: Copy if newer

Our .funcignore file looks like this

## Files that should be ignored from Azure Deployment

# EasyAuth Debugging file
local.funcdebugging.json

Despite these settings the debugging file still get's deployed. How can I prevent this file being part of the Azure Deployment?

Pat Long - Munkii Yebee
  • 3,592
  • 2
  • 34
  • 68

2 Answers2

1

We have been unable to get .funcignore to work.

Our alternative solution is

  1. Remove "local.funcdebugging.json" from repo
  2. Add a markdown debugging readme that explains how to use a file called
    local.funcdebugging.json and include some sample content
  3. Add a "local.funcdebugging.json" entry to .gitignore in case future debugging attempts don't get tidied up and it ends up being added to repo and therefore deployed
Pat Long - Munkii Yebee
  • 3,592
  • 2
  • 34
  • 68
0

It seems like you're trying to publish a .csproj. It's possible to customize what's copied to the publish directory with the CopyToPublishDirectory option. That's the directory created by the dotnet publish command.

For example in our case, we don't want to publish our Typescript source code, only the generated javascript code. We use the following configuration:

<ItemGroup>
  <Content Update="wwwroot\src\**\*.*" CopyToPublishDirectory="Never" />
  <Content Update="wwwroot\vendor\**\*.*" CopyToPublishDirectory="Never" />
  <Content Update="Locales\**\*.*" CopyToPublishDirectory="Always" />
</ItemGroup>

With this, the source files are copied to the output directory, so they're available during debugging, but they're not copied to the publish directory, and thus it's not included in the deployed package.

Métoule
  • 13,062
  • 2
  • 56
  • 84