1

I need to build a batch file that runs on a directory and digs inside for suitable c# projects to compile. (and compile them of course).

I don't know the name of the projects inside the directory.

I can assume all project are in c# and written in VS2008 and above (if that helps).

3
  • 1
    Are those projects independnt? Ms Build can not resolve the correct build order from the proj file, you ned solution Commented Oct 28, 2010 at 20:09
  • Yes they are. I can't add them to one solution. Also, I think I mislead you, I need to create an .exe out of the projects, so probably I need to "build" and not "compile". Commented Oct 28, 2010 at 20:11
  • There are no dependencies between the projects. Commented Oct 28, 2010 at 20:29

1 Answer 1

3
setlocal
SET CMD= msbuild.exe 

for /R %%d in (*.csproj) do %CMD% %%d
endlocal

This will build each project into individual assemblies, with all default build properties for each project. You can specify additional properties, or an MSBuild config file to use.

Sign up to request clarification or add additional context in comments.

2 Comments

Where do I put the path to the project? (For instance, it sits at c:\projects)
You can add a CD command to c:\projects, or put the batch file there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.