Skip to content

fix: skip Visual Studio's .vs folder when copying source - #982

Open
zakky8 wants to merge 1 commit into
aws:developfrom
zakky8:fix/7886-exclude-vs-folder
Open

zakky8 wants to merge 1 commit into
aws:developfrom
zakky8:fix/7886-exclude-vs-folder

Conversation

@zakky8

@zakky8 zakky8 commented Nov 29, 2026

Copy link
Copy Markdown

Issue #, if available: Fixes aws/aws-sam-cli#7886

Description of changes

CopySourceAction copies the whole source directory, including Visual Studio's .vs folder. Visual Studio keeps files under .vs (for example FileContentIndex\*.vsidx) open without sharing, so on Windows the copy fails with [Errno 13] Permission denied while VS is open.

This adds .vs to EXCLUDED_FILES in every workflow that copies the full source with CopySourceAction: custom_make, java_maven, nodejs_npm, nodejs_npm_esbuild, python_pip, python_uv and ruby_bundler. The pip and uv workflows already exclude .vscode and .idea. Configurable ignore lists are left for a separate change.

One case this does not cover: when package.json is in the source directory, the npm workflow runs npm pack on the source first, and npm reads .vs itself unless .npmignore or .gitignore excludes it. Visual Studio's default .gitignore lists .vs/.

Description of how you validated changes

  • New functional test in tests/functional/test_actions.py: runs CopySourceAction with each of those workflows' EXCLUDED_FILES on a real directory containing .vs. It fails on develop (7 of 7) and passes with the change.
  • Reproduced on Windows 11: held .vs\FileContentIndex\x.vsidx open with CreateFileW share mode 0. Before the change, CopySourceAction with CustomMakeWorkflow.EXCLUDED_FILES raised PermissionError: [WinError 32] The process cannot access the file because it is being used by another process. After it, the copy succeeds and .vs is skipped.
  • make test equivalent (unit + functional): 1218 passed, 4 skipped, coverage 95.11%. ruff check aws_lambda_builders and black --check pass.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Visual Studio keeps files under .vs open without sharing, so copying
the source on Windows fails with Permission denied while it is open.
Add .vs to EXCLUDED_FILES in every workflow that copies the full
source with CopySourceAction.

Fixes aws/aws-sam-cli#7886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: sam build fails if Visual Studio is open

1 participant