Is Projucer overwriting Visual Studio 2019 Project Properties?

I just noticed when reopening a finished project, that all the “Release” setting I changed, and thought was saved with the project, is back to default.

Furthermore a custom solution configuration created in “Configuration Manager” also saved with project is gone.

I can reproduce this problem, every time I start VS, edit some setting “Alt-F7”, save the project, close VS, and reopening from Projucer, and all it now back to default.

So my questions is; Is that Projucer that is overwriting my Project Properties, or is it Visual Studio, or am I misunderstanding something in VS and to actually have the settings saved I need to do it differently?

In particular I am changing some C/C++ Optimizations and Runtime Library settings.

As far as I know, yes, it does overwrite the project each time you save it.

Yes, you need to make your changes in the Projucer VS2019 exporter settings. Not all options are available, but most of the time you can use “extra compiler flags” and “extra linker flags” to get what you want.

1 Like

Projucer reads and writes the .jucer file. Projucer also writes files for Visual Studio (.sln, .vcxproj and .vcxproj.filters) on save, but it never reads these files. This means that any configuration change you do in Visual Studio is invisible to Projucer.

Thus you should do all configuration changes in Projucer, so they are persisted in the .jucer file.

2 Likes

Ok thanks and to @McMartin

And on the same note, I was investigating how to add a program icon, like the Window OS desktop exe file icon, to my app in Visual Studio, but with this information you now provided me, I would not be surprised if Projucer would overwrite that too.

Oops I just opened Projucer and looking in Exporter Settings. I now see a place for an Icon, sorry.

1 Like

Ok how exactly do I define these extra compiler flags.

I tried this “{Ob2} {Oi} ${Ot}”

and this “{/Ob2} {/Oi} ${/Ot}”

and this "b2${O} i${O} t${O}

and this “/Ob2 /Oi /Ot”

but apparently all of those are wrong, as they have no effect when relaunching VS.

The expected syntax it “/Ob2 /Oi /Ot”, like you would pass them to the compiler on the command line.

Where exactly are you specifying these compiler flags? They are related to optimization, and should be set on a configuration, not on the exporter.

BTW, /O2 (Maximize Speed) is equivalent to /Og /Oi /Ot /Oy /Ob2 /GF /Gy, so if you already have /O2 passed to the compiler, adding “/Ob2 /Oi /Ot” won’t change anything (see https://docs.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=vs-2019 for more information).

Trying to set in “Release - Preprocessor Definitions”.

I got what you said about “/O2”, thanks. So the only one I would like to set in Projucer - Release is “/GS-”. So exactly where do I set that?

Preprocessor Definitions are identifiers that you can manipulate in your C++ code with preprocessor directives like #if, #if defined(), #else, #endif, #define, #undef, etc. They are not compiler flags.

Ok got it, thanks. So as I just edited in above post, when you were replying, where do I then set “/GS-” which is under “Code Generation” in VS?

I’m sorry for misleading you, I thought that Projucer had a field for per-configuration compiler flags, but it doesn’t…

You could specify “/GS-” in the “Extra Compiler Flags” field of the exporter, but then it would apply to all configurations. Maybe that’s fine for you.

Ok thank you very much for your help.

1 Like