Edit

Share via


MSB1003 diagnostic code

This article describes the MSB1003 error code.

Message text

MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

Description

This error occurs when MSBuild doesn't find a project file or solution file that it can build. It occurs when you don't specify a project or solution file on the command line. In that case, MSBuild tries to find one in the current working directory. If it doesn't find one, you get this error.

Resolution

If you typed the command, make sure you're in the right directory, a directory that contains a project file or a solution file. Project files have extensions that end in "proj", for example, .csproj or .vbproj. Solution files have the extension .sln (or .slnx with MSBuild 17.13 and later).

This error can occur if you execute an earlier version of MSBuild on a folder that contains an slnx file. You need MSBuild 17.13 or later to build .slnx solution files.

If the extension is incorrect, perhaps when a project or solution file was renamed without paying attention to the file extension conventions, you might get this error. MSBuild only searches for files that have an extension that ends with proj. If yours does not, you may need to specify it explicitly.

If you encounter this error when running a build script, check the logic of the build script to make sure the MSBuild command is being run from the right working directory, and that the directory contains a project or solution file.

If you're trying to compile code without a project file, and you have Visual Studio, try opening the folder in Visual Studio using Open Folder, and build it.

If you aren't using Visual Studio, such as when you're building a .NET Core application on Linux or macOS, you can create a project file using dotnet new and modify it as necessary.

Applies to

All versions of MSBuild