Page 1 of 2

TwineCompile with MSbuild, but not with IDE

Posted: Tue Feb 02, 2021 3:45 am
by zzattack
I would like to (always) use TwineCompile when building my project group using msbuild. For that I import the 'TCTargets104.targets' project, and this works very well.
Simultaneously, I'd like to be able to disable TC from the IDE as necessary. Debugging sessions typically start faster when TC is disabled, and some error messages show up in a relevant part of the .targets file if builds fail, which is tougher to debug.
What I've noticed is that when the 'TCTargets104.targets' is imported, even when TwineCompile from the IDE is disabled, builds still use TC but the GUI process doesn't show. I think what is needed is to conditionally import the project task, only when run from msbuild. Is this possible?

Re: TwineCompile with MSbuild, but not with IDE

Posted: Tue Feb 02, 2021 6:11 pm
by jomitech
Yes, it is definitely possible. You need to add a condition to the <Import> statement, for example:

Code: Select all

<Import Project="C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets104.targets" Condition="'$(TwineCompile)'=='true'" />
Then you can invoke MSBuild like this and it will invoke TwineCompile. The IDE will not pass in that variable, so TwineCompile won't be used.

MSBuild /t:Build /p:TwineCompile=true Project1.cbproj

Re: TwineCompile with MSbuild, but not with IDE

Posted: Tue Feb 02, 2021 7:34 pm
by zzattack
Excellent, thank you. I slightly prefer using msbuild in this way over jtmake, due to the cleaner logfile and '/ds' overview at the end.

Re: TwineCompile with MSbuild, but not with IDE

Posted: Thu Feb 04, 2021 3:15 pm
by zzattack
Followup question: can we pass arguments like -prog- through msbuild?

Re: TwineCompile with MSbuild, but not with IDE

Posted: Thu Feb 04, 2021 6:52 pm
by jomitech
Most of the TwineCompile options are available via MSBuild properties, but unfortunately, -prog- is not one of the available options. The available options are:
  • -threads: TC_Threads
  • -disablecaching: TC_DisableCaching
  • -afiles: TC_AllocateFiles
  • -jb-: TC_StopOnErrors
  • -dep: TC_Make
  • -priority: TC_Priority
  • -maxcache: TC_MaxCache
For example:

Code: Select all

MSBuild /t:Build /p:TC_Threads=4 Project1.cbproj

Re: TwineCompile with MSbuild, but not with IDE

Posted: Sun Feb 07, 2021 10:26 am
by zzattack
Clear, thank you. If feasible, I'd like to request this feature be extended to include -prog- for a future release. Thanks you for your consideration!

Re: TwineCompile with MSbuild, but not with IDE

Posted: Mon Feb 08, 2021 6:20 pm
by jomitech
Yes, we'll definitely include this in the next release. It looks like the only missing option.

Re: TwineCompile with MSbuild, but not with IDE

Posted: Tue Feb 09, 2021 8:09 am
by zzattack
Awesome, I'll keep my eyes peeled. Thank you!

Re: TwineCompile with MSbuild, but not with IDE

Posted: Tue Mar 02, 2021 3:16 am
by zzattack
Hi Jon,
Did this make it into 5.2.3?

Re: TwineCompile with MSbuild, but not with IDE

Posted: Tue Mar 02, 2021 8:28 am
by jomitech
Yes, it did.