简体   繁体   中英

Building multiple projects in MS visual studio 2013

I have a MS Visual Studio 13 solution that has many (ca 20) projects inside. Projects share some source code files.

I didn't figure out how to build all projects at once. When I select them and do Build > Build selection , or just Build > Build solution , visual studio throws such errors:

Error 249 error C1083: Cannot open compiler generated file: 'x64\Release\blabla.obj': Permission denied D:\xxx\yyy\src\blabla.cpp 1 1 Project001

Probably because that particular file is compiled by several projects at the same time. If I build all the projects one after another everything is good, but it is annoying work.

Thanks for help!

VS has a way to specify the build order of projects in a solution (Right click the solution in the Solution Explorer) If Project A depends on Project B then you can specify that and then the projects will build in the order you expect.

I wonder whether you want to build all projects at once or compile only one Project at time?

When you run a project, VS will automatically do any and all building necessary to run your startup project. It will also determine this order for you based on the dependency tree. You shouldn't need to edit this under most circumstances. VS lets you do so by editing the dependencies. Right click on your project and select Build Dependencies > Project Build Order to see the current build order and edit your dependencies, which will affect the build order.

For more details I suggest you could refer to the link: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-create-and-remove-project-dependencies?view=vs-2019

Problem was that many of my projects shared the same namespace.

After making the RootNamespace unique for all the projects everything works fine.

This is where to find it in *.vcxproj file

  <PropertyGroup Label="Globals">
    <ProjectGuid>{85936F95-D218-4D69-B8F2-684C2A86F850}</ProjectGuid>
    <RootNamespace>THIS_MUST_BE_UNIQUE</RootNamespace>
  </PropertyGroup>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM