SMP solution compilation error: The project was unable to create an internal item (the component map file).
Our team has recently come across an interesting compilation error and I thought I'd share our findings here in case someone else runs into the same issue. It took some time to figure out what caused the compilation error, so our findings will (hopefully) save someone else time and effort.
A couple words about the structure of our solution: we use Visual Studio 2010 (and VS2010 integration from Altiris SDK) and have a mixture of SMP project, Unit test (Test) project and Web/Class Library projects.
At some point we had to re-organize our solution and recreated it from scratch based on existing projects. After that reorganization we started getting the compiler error for SMP project
The project was unable to create an internal item (the component map file). This is usually because the project file is read-only, or the source control provider prevented the items from being added to the project.
Of course, the first thing we checked was the things that the error message calls for: the SMP project was not read-only & source control couldn't do anything with it as we don't use Visual Studio integration with source control (i.e. Visual Studio is unaware of source control used for the source code). After a lot of digging and experiments we found that the error is somehow dependent content of solution (.sln) file. That expedited the further progress and we ended up finding out that the error is only reported for any setup-related project (i.e. project producing MSI as its output - e.g. SMP project) if it's declared in solution file after unit test (Test) project. In other words, if unit test project is declared last, the error does not occur. By "project declared" I'm referring to
Project("...") = ....
block in the .sln file.
There doesn't seem to be a way in Visual Studio to control the order of projects in .sln file (except for removing the project from solution and re-adding it -- in this case VS2010 seems to put the project as the last one), so we ended up manually editing the .sln file and fixed the error this way.
The moral here is this: if you get this compilation error, check the order of projects definitions in .sln and try making sure Test projects are declared last. This may just make the error go away.