I created a multi-project template and connected it with a wizard.
Everything is working fine, and I can restore packages using update-package -reinstall in the package console manager.
I'm trying to add Elmah & ApplicationInsights with a condition in the .csproj file of the template, so that it'll add Elmah or ApplicationInsights based on the answer to the wizard.
I tried doing the following which didn't work:
<Reference Include="elmah, Version=1.2.2, Culture=neutral" Condition="$($ext_custommessage$) == 'LAN'" />
I tried adding it in a <ItemGroup> element but no dice.
What should I do in this case to add these packages to the .csproj file?
I think that the easiest way to do this is to have both packages installed. Then only configure ELMAH when running on localhost. I'm guessing you have
web.configandweb.release.configfiles. You then include ELMAH config in theweb.configone but remove it using XDT in theweb.release.configone. It's basically described in reverse here: https://docs.elmah.io/use-multiple-logs-for-different-environments/#logging-to-elmahio-from-production-only (only logging from production). Also, the example is for elmah.io (cloud version of ELMAH) but you can use any logger implementation you'd like. I'm not sure how you'd configure AI but you can probably use a similar approach there.