MSBuild may build projects in unexpected order with MSBuild project task, leading to errors like CS0006
MSBuild may build projects in unexpected order with MSBuild project task, leading to errors like CS0006
RAPID PUBLISHING
Action
Result
CSC : error CS0006: Metadata file ‘… <dependency_file_name>’ could not be found.
Cause
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.
Resolution
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.
More Information
MSBuild Project File Schema Reference (http://msdn.microsoft.com/en-us/library/5dy88c2e.aspx)
DISCLAIMER
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.
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
Microsoft Corporation. All rights reserved. Terms of Use | Trademarks
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Back to the top
Leave a Reply