2

while building my solution from commandline

msbuild "app1.Web.test.sln /target:package

I'm getting the below error

error:MSB4057 "The target not found in the project"

So I googled for a solution and found the below link which is similar to my scenario.

link

as per the solution provided in the link I tried the below command

msbuild app1.Web.test.sln /t:app1_Web_test:Package

and the below snippet saved in to my solution folder with the name before.app1.Web.test.sln.targets

 <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <Target Name="app1_Web_test:WebPublish">
        <MSBuild
            Condition="'%(ProjectReference.Identity)' == '$(SolutionDir)app1.Web.test.sln'"
            Projects="@(ProjectReference)"
            Targets="package"
            BuildInParallel="True"
            ToolsVersion="4.0"
            Properties="BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)"
            SkipNonexistentProjects="%(ProjectReference.SkipNonexistentProjects)" /> 

But still the issue persists.

Can anybody figure out where it gone wrong?

Community
  • 1
  • 1
user1357872
  • 783
  • 3
  • 11
  • 31

1 Answers1

0

Is your project in a folder in the solution?

I am currently having in issue trying to build projects that are in folders in my solution. They build fine in Visual Studio using devenv but fail when using MSBuild in Azure.

When I move the csproj project from the folder in my solution to the root level it then finds it.

Is there a way of specifying the folder in the \t: parameter?

The folder is not a real file system folder just part of the tree structure displayed my the solution sln file.

AnthonyLambert
  • 8,768
  • 4
  • 37
  • 72