Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild: Conditional Construct (Project Reference | File Reference)

I´m still trying to eleminate the need of a cobol compiler in a Project with cobol-Projects in it.

Is it possible to create following build behaviour:

If the Configuration is Debug then use ProjectReferences on ExCobol.cblproj if the Configuration is DebugVB then use FileReferences on ExCobol.dll

When Yes, How to achieve it?

I assume the use of tags in the project file will do the trick.

And does this really eliminate the need of a cobol compiler for the DebugVB Configuration?

like image 200
Doc Snuggles Avatar asked Feb 16 '26 22:02

Doc Snuggles


1 Answers

Regarding the conditional 'how', assuming you have either

<ProjectReference ...>...</ProjectReference>

or

<Reference ...>...</Reference>

you want to hand-edit the .proj file to include both thusly

<ProjectReference Condition="'$(Configuration)'!='DebugVB'" ...>...</ProjectReference>
<Reference Condition="'$(Configuration)'=='DebugVB'" ...>...</Reference>
like image 120
Brian Avatar answered Feb 19 '26 08:02

Brian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!