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

Bishoy 0 Reputation points
2024-04-07T20:09:59.9766667+00:00

I'm studying a course https://learn.microsoft.com/en-us/training/modules/challenge-project-develop-branching-looping-structures-c-sharp/2-prepare
and requested to download project file Lab Files

after following all steps and open folder on VSC, when trying to build project I get error :
PS C:\Users\Bishoy\OneDrive\Desktop\ChallengeProject> dotnet build

MSBuild version 17.9.6+a4ecab324 for .NET

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

PS C:\Users\Bishoy\OneDrive\Desktop\ChallengeProject>

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,623 questions
{count} votes

1 answer

Sort by: Most helpful
  1. anand 220 Reputation points
    2024-04-08T00:36:53.2333333+00:00

    Hi Bishoy,   

    Thank you for reaching out to Microsoft Q & A forum.

    Regarding the MSB1003 error you encountered while working on your ASP.NET Core MVC application. I understand the frustration this issue may have caused, and I'm here to assist you in resolving it. 

    The MSB1003 error typically occurs when the dotnet build or dotnet publish command cannot find a project or solution file in the specified directory. To troubleshoot this issue, let's go through the following steps together: 

     

    Verify Project Structure: Ensure that the dotnet publish command is executed from the appropriate directory (BestBikeApp), where your ASP.NET Core MVC project is located. 

    Confirm Publish Output: Following the execution of dotnet publish -o pub, navigate to the pub directory using the cd pub command. Validate the successful generation of publish output by utilizing the ls command to list the directory contents. Verify the presence of necessary files to ensure a complete publication process. 

    Create Zip File: Within the pub directory, execute the **zip -r site.zip *** command to generate a zip file containing the published files. Confirm the successful execution of this command without encountering any errors. 

    Azure Web App Deployment: Replace the placeholders [sandbox resource group name] and <your-app-name> with the corresponding actual names of the Azure resource group and Azure Web App to which you intend to deploy your application. 

    Validate Azure CLI Access: Ensure that you possess the requisite permissions to deploy to Azure Web App using Azure CLI. If deploying from Azure Cloud Shell, ensure authentication and necessary permissions are granted to execute deployment tasks. 

    Verify Resource Group Name and App Name: Double-check the substitution of [sandbox resource group name] and <your-app-name> placeholders for accurate values. Confirm that these values correspond precisely to the designated Azure resource group and Azure Web App intended for deployment.  

    If you encounter any future issues, please feel free to contact us, and we will be pleased to assist you further.   

    If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.   

    Thank you.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.