Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to set the startup project when multiple projects are defined? #462

Open
Rseding91 opened this issue Jul 10, 2018 · 5 comments

Comments

@Rseding91
Copy link

Right now from what I've found Fastbuild sorts 'SolutionProjects' alphabetically and when no .suo file is generated Visual Studio selects the first project as the "Startup Project" (the project that builds and launches when you press F5).

Is there currently any way to override this behavior and set the startup project through the .bff script? Or perhaps a way to not sort the 'SolutionProjects' so I can just define the order they're listed in the file which would also address this?

@Dandielo
Copy link
Contributor

You should be able to set the startup project using the VSSolution function with the .SolutionBuildProject property.

http://www.fastbuild.org/docs/functions/vssolution.html

P.S. Love your game ;d

@Rseding91
Copy link
Author

The SolutionBuildProject is the F7 key (build solution). I'm talking about the F5 key (start debugging) which has an option of "build startup project and lauch with the debugger attached".

In this case the startup project ends up being the first in the list as I described above.

Also, how did you know I work on Factorio? :)

@ffulin
Copy link
Contributor

ffulin commented Jul 11, 2018

I did some tests locally, and the behavior of which project is the active project by default seems more complex than simply being based on order.

As an example, I experienced the following with the FASTBuild.sln:

  • "All" is selected by default. This is the first project listed in the sln
  • If I swap the "All" project with the next one (Core), "All" is still selected by default
  • If I remove "All" from the solution, "FBuildCore" is now selected by default (even though it is after "Core" both in sln order and alphabetically)

As you noted, .SolutionBuildProject impacts which project is built when doing a solution build. Just to be sure it wasn't impacting the priority somehow, I removed setting it. It seemed to not change the behavior of the default selected project at all.

Conceivably, if we could understand the logic being used, we might be able to manipulate the project layout to control what is selected, but the current ordering is as it is in order to exactly match what Visual Studio saves out so that you don't get massive deltas if you manually change the project and save. Perhaps this can be controlled with an option on the Solution() so you can opt-in.

Maybe I've misunderstood you, but I think right now we don't really know exactly how the default project is actually chosen.

@Dandielo
Copy link
Contributor

Dandielo commented Jul 11, 2018

@Rseding91 Sorry I didn't got the question on the first time.

P.S. well, friday facts are my bread and butter, so your nickname is quite know to me already ;d I do especially like the technical ones as a developer :P

@ffulin I know that the premake5 team did work it out how it's done, I've just checked if it really works and you may look at the generated differences with this example premake5 file.

https://gist.github.com/Dandielo/6c71ee8ebef3e1fe5bae29215be964b5

And run it with the command 'premake5 vs2017' in the same location where this file is located.

And here is a small comment how it's probably working.

https://github.com/premake/premake-core/blob/master/modules/vstudio/vs2005_solution.lua#L72

Generally you just move the group and all it's child projects to the top of each section in the solution file.

@Sha1962
Copy link

Sha1962 commented Sep 7, 2020

Create another workspace section after your projects then add the line startproject "ProjectRequired" in premake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants