Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions docs/visual-basic/misc/bc2001.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "Learn more about: File <filename> could not be found"
title: "File <filename> could not be found"
ms.date: 07/20/2015
ms.date: 01/24/2025
f1_keywords:
- "bc2001"
- "vbc2001"
Expand All @@ -11,14 +11,36 @@ ms.assetid: 1aa8fb26-9a48-4c27-9ff4-67cf1d423b57
---
# File \<filename> could not be found

The specified file could not be located. This may be a result of supplying an incorrect file path.

**Error ID:** BC2001

The specified file could not be located. This error occurs when the Visual Basic compiler (`vbc`) cannot find a file that is referenced in your compilation.

**Error ID:** BC2001

## Common causes

This error can occur when a file is referenced in any of the following ways but cannot be found:

- **Command-line compilation**: The file is specified as a source file or reference on the command line
- **Response files**: The file is listed in a response file (`.rsp`) used by the compiler
- **Project references**: The file is referenced as an assembly or module in your project
- **Compiler options**: The file is specified with options like `-reference`, `-addmodule`, or `-keyfile`

The error appears with "vbc" in the File column because the Visual Basic compiler itself is reporting that it cannot locate the referenced file.

## To correct this error

- Check that the file name and path are correct.


1. **Check the file path**: Verify that the file name and path are correct, including proper spelling and case sensitivity.

1. **Check response files**: If using response files (like `vbc.rsp`), verify that all files listed in the response file exist at the specified paths.

1. **Check project references**: In Visual Studio, examine your project references to identify any broken references to assemblies or other projects.

1. **Check compiler options**: If compiling from the command line, verify that files specified with `-reference`, `-addmodule`, or other file-related options exist.

1. **Check excluded files**: If you intentionally excluded a file from your project but it's still being referenced elsewhere, either restore the file or remove the reference.

## See also

- [How to: Parse File Paths](../developing-apps/programming/drives-directories-files/how-to-parse-file-paths.md)
- [-reference (Visual Basic)](../reference/command-line-compiler/reference.md)
- [@ (Specify Response File) (Visual Basic)](../reference/command-line-compiler/specify-response-file.md)
- [Managing references in a project](/visualstudio/ide/managing-references-in-a-project)
Loading