RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
You use MSBuild on the command line and pass an XML file containing the build project. Rather than building a .sln directly, the XML project file contains an MSBuild task. Specify /p:platform=[some platform name] or /p:configuration=[some configuration name] in the command line, or specify these as global properties to the MSBuild task.
The following, or similar, error may be thrown: CSC : error CS0006: Metadata file '…\<dependency_file_name>' could not be found.
If the platform or configuration name properties are not found in the solution file, the step of scanning for dependencies is skipped. Thus, the dependency relationships are not maintained and projects may build out of order.
MSBuild produces the temporary solution object with everything at the same dependency level, then builds it with the properties specified.
There are several workarounds available depending on different scenarios:
1. Modify the solution file (which may contain a mixture of project types) so that it contains a configuration that matches the name to be passed on the command line.
2. In the .xml file, instead of using the MSBuild task, use the Exec task to launch msbuild.exe on the solution.The potential disadvantages of this are that logging won’t work so well. Also the multiprocessor build will not be synchronised.
3. Build the solution file directly, i.e. msbuild.exe mysolution.sln /p:xx=yy ... without an .xml file involved.
4. Build all the projects in the solution with the MSBuild task in the .xml file instead of building the .sln file.
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.