Reputation: 9737
I am attempting to kick off a .net Build using MSBuild from RTC (BuildForge). I keep getting the following exception:
error MSB1009: Project file does not exist. Switch: F:\Program Files (x86)\IBM\Build Forge\Agent\Captiva_Build_dotNET\BUILD_117\xxxxxx\Source Code\Components\xxxxxx\xxxxxxx.sln
The build command is as follows
MSBuild.exe "xxxx.sln" /t:xxx_yyyy_zzzzzz_asdfasdf_base
Where /t:
Is one of the projects in the solution. I don't understand what I am doing wrong. I have the _
in the statement. That should be an easy build? Any ideas?
Upvotes: 5
Views: 18967
Reputation: 4083
msbuild.exe /t:target
is used to execute a particular target within a solution or project.
msbuild.exe MySolution.sln /t:Clean
To build a particular project you'd specify the project file rather than the solution.
msbuild.exe MyProject.csproj
Edit:
Eureka, you're absolutely right, I have used the MsBuildEmitSolution
env variable to output the metaproj script, but never seen that before.
So before you can arrive at this:
MsBuild.exe MySolution.sln /t:ProjectName:TargetName
At the command line, set MsBuildEmitSolution:
set MsBuildEmitSolution=1
Then generate your metaproj.
MsBuild.exe MySolution.sln /pp
Open the output file MySolution.sln.metaproj
in notepad and scroll down and find the relevant <Target />
node you wish to build and note the Name attribute string.
<Target Name="Client_Test:Build">
<MSBuild Condition="'%(ProjectReference.Identity)' == '...Client_Test.csproj'" Projects="@(ProjectReference)" Targets="Publish" BuildInParallel="True" ToolsVersion="$(ProjectToolsVersion)" Properties="..." />
</Target>
And VOILA!
MsBuild.exe MySolution.sln /t:"Client_Test:Build"
Upvotes: 14