views:

894

answers:

2

Summary: I'm able to compile a RAD Studio 2009 project using MSBuild on a Build Server using the RAD Studio Command Prompt, but not with a batch file. This same batch file, however, works successfully on my workstation. On the server the error returned is: MSB4057.

I'm just learning how to use MSBuild with RAD Studio and am trying to get the MSBuild stuff to work with it. I've generated a batch program that will set the environment variables appropriately and then compiles the project for me. This is working fine on my workstation.

However, when I move everything over to a build server it doesn't work.

I think I'm close to the answer to why this is happening. I can get my project to compile from the RAD Studio Command Prompt by typing this on the server:

msbuild C:\MyProject\Group\Project.groupproj

This is my command file that I am trying to run:

@SET BDS=C:\RS\
@SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\6.0
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%%FrameworkVersion%;%FrameworkSDKDir%;%PATH%

msbuild C:\MyProject\Group\Project.groupproj /t:Clean;Build /p:"Config=Release"

This is the output from the command prompt:

C:\>msbuild C:\MyProject\Group\Project.groupproj /t:Clean;Build /p:"Config
=Release"
Microsoft (R) Build Engine Version 2.0.50727.1434
[Microsoft .NET Framework, Version 2.0.50727.1434]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 12/2/2008 12:24:26 PM.
__________________________________________________
Project "C:\MyProject\Group\Project.groupproj" (Clean;Build target(s)):

Target Clean:
    Target Project1:Clean:
        __________________________________________________
        Project "C:\MyProject\Group\Project.groupproj" is building "C:\MyProject\Project1\Project1.cbproj" (Clean target(s)):

        C:\MyProject\Project1\Project1.cbproj : error MSB4057: The target "Clean" does not exist in the project.

        Done building project "Project1.cbproj" -- FAILED.

Build FAILED.
C:\MyProject\Project1\Project1.cbproj : error MSB4057: The target "Clean" does not
 exist in the project.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.01
+2  A: 

I figured it out. After tracing through pages of google search results trying to figure out a way to make my auto build server process this, I looked at the paths in the batch program and noticed it was different than the install path.

@SET BDS=C:\RS\

should have been

@SET BDS=C:\RS\6.0\

Lesson to learn: MSBUILD can return the MSB4057 error when it can't resolve the BDS path.

Side Note: If this simple fix doesn't work for you, make sure you have proper trace instructions in your project files. see this article on msdn

Jeremiah
A: 

This article saved the day thank you sir.