Skip to content

The .gitignore generated by the core tools excludes all bin folders that can cause issues with PowerShell modules #4239

@eamonoreilly

Description

@eamonoreilly

Version

4.0.6280

Description

If customers want to bring their own PowerShell modules, we idicate they can save them to the Modules folder and they will be included in the build package if they are uploaded to github. In our current .gitignore, we specify bin so that we don't pick up generated files but PowerShell modules can include bin folders like in https://www.powershellgallery.com/packages/Az.Storage/8.1.0 (if you expand the file list you will see the file Storage.Autorest\bin\Az.Storage.private.dll).

This will result in the bin folder and its contents not making it to github and will eventually fail when that file is attempted to be loaded at runtime.
I believe the .gitignore used is https://github.com/Azure/azure-functions-core-tools/blob/main/src/Azure.Functions.Cli/StaticResources/gitignore

A possible fix is to exclude all files in bin folders except for the Modules folder.
**/bin/**
!Modules/**

Steps to reproduce

Create a PowerShell function app with PowerShell modules.

  1. pwsh
  2. git init
  3. func new
  4. mkdir Modules
  5. Save-Module az.storage -Path Modules

Expand the git changes and Modules/Az.Storage/8.1.0/Storage.Autorest/bin will be excluded from source control.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions