You may know that you can pass parameters to MSBuild to populate properties contained in a PropertyGroup.
Below is an example MSBuild file we can use for the purpose of demonstrating passing properties:
- As you may know in MSBuild v. 3.5 and above, you can also nest PropertyGroup elements inside of Target element. Unfortunately, if you do so, you will not be able to pass those external parameters to your MSBuild script.
- Also, when you are passing parameters to MSBuild, make sure that you do not send the last parameter with a trailing semicolon such as: /p:AppPoolName=TestAppPool;AppPoolVersion=v4.0;.
If you do so, you will receive the following error message:
MSBUILD : error MSB1005: Specify a property and its value.
For switch syntax, type "MSBuild /help"
Therefore, instead, you need to pass the parameters in this manner to avoid that error message: /p:AppPoolName=TestAppPool;AppPoolVersion=v4.0.
Hopefully, these words of advice can help you avoid similar problems/issues while developing and testing your MSBuild scripts.