2

I am working on an big old project. MSBuild is used as the build engine. And I see a lot of .proj, .bat, .sln and .csprj files used in the build process.

I know that .sln file and .csprj can be edit relatively easily with Visual Studio. But is there some easy way to help write and comprehend the .proj and .bat files?

Also, I am lost in the numerous environment variables such as $(SolutionFolder), where can I find the definitions for them?

Many thanks...

smwikipedia
  • 61,609
  • 92
  • 309
  • 482

2 Answers2

2

The following description is based on how I made use of such files in the open source project, http://code.google.com/p/lextudio/source/browse/#svn%2Ftrunk%2Ftrunk

.sln and .csproj should never be manually edited unless you are asked to. They should be mainly maintained by developers via Visual Studio.

Your focus should be put on the .proj file, where custom targets and properties are set. They are usually manually created and calling MSBuild to build .sln/.csproj in an expected way.

You can edit .proj files inside Visual Studio, as VS knows it is a MSBuild script type.

.bat files are usually wrappers over the core .proj file, so as to let you execute a certain target with expected properties, so it may only contain a call command to MSBuild.exe. I usually use Notepad++ to edit such files, as n++ provides highlighting for .bat files.

Many of the predefined properties are documented by Microsoft, as the link posted by @mortb shows.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
1

.bat files are batch files. They cointains script that are executed by the windows command prompt. Each row contains a statement (like copy, execute program etc) that could be entered at the command prompt. I usually edit bat files in notepad, you may also edit them as text in visual studio. The windows help contains more information about batch files.

.proj is a generic Visual Studio project file

Finding a reference to the variables wasn't too hard: http://msdn.microsoft.com/en-us/library/c02as0cs.aspx

Hope this helps

mortb
  • 9,361
  • 3
  • 26
  • 44
  • 1
    You should NOT edit .bat or .cmd files with VS. It will encode the files in UTF-8 and make them unusable by the command prompt see https://connect.microsoft.com/VisualStudio/feedback/details/566322/vs-2010-changs-encoding-of-cmd-file-to-utf-8. – Sayed Ibrahim Hashimi Apr 20 '12 at 04:20