How can I manually build my dotnet framework project ?

Luna Goodnight 1 Reputation point
2021-10-25T06:43:11.09+00:00

I have a dotnet Framework project, and I want to build it in order to create CICD pipeline.
I create the project and type " dotnet build ", it fails and shows the following error:

PS C:\try\WebApplication1> dotnet build
    Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
    Copyright (C) Microsoft Corporation. All rights reserved.

      Determining projects to restore...
      Nothing to do. None of the projects specified contain packages to restore.
    C:\try\WebApplication1\WebApplication1\WebApplication1.csproj(184,5): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\5.0.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression i
    n the Import declaration "C:\Program Files\dotnet\sdk\5.0.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.

    Build FAILED.

    C:\try\WebApplication1\WebApplication1\WebApplication1.csproj(184,5): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\5.0.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression i
    n the Import declaration "C:\Program Files\dotnet\sdk\5.0.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.
        0 Warning(s)
        1 Error(s)

It's there anything I am missing? Thanks! 
Community Center | Not monitored
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2021-10-25T14:31:11.557+00:00

    dotnet command is for .NET Core project only. If you are trying to build legacy .NET Framework projects, learn to use msbuild.

    0 comments No comments

  2. Silvio Sodre Pacheco 1 Reputation point
    2022-02-22T12:05:07.17+00:00

    @Luna Goodnight , have you got success trying to build .NET Framework in CICD pipeline? I think you are trying to do this using a linux docke image (probably dotnet/sdk), are you?

    @Anonymous , is there a linux docker image which has msbuild command? The dotnet/sdk image doesn't have.

    Thanks in advance!


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.