We have a Blazor Template that we created for our team, to help new developers get up and running faster. One of the pre-installed NuGet packages that we are including with this template is Nlog.
I was provided the nlog.config file below:
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><targets><target name="logfile" fileName="C:/webcorp/NLogs/KitchenSink/${shortdate}/${logger}.txt" xsi:type="File"><layout xsi:type="JsonLayout"><attribute name="time" layout="${longdate}" /><attribute name="logger" layout="${logger}" /><attribute name="level" layout="${level}" /><attribute name="callsite" layout="${callsite}" /><attribute name="message" layout="${message}" /></layout></target></targets><rules><logger name="*" minlevel="Trace" writeTo="logfile" /><logger name="*" minlevel="Info" writeTo="jsonFile" /><logger name="*" minlevel="Info" readFrom="jsonFile" /></rules>In the 'target name' attribute, I want to replace 'KitchenSink' with the Project Solution name, dynamically. Because, this file will be included in the template and (obviously), not all applications will be called KitchenSink.
My area of expertise is in CSS and GUI design. And I am struggling to find a way to get the solution name dynamically.
I found This:
$(MSBuildProjectName).exeHowever, when I replaced 'KitchenSink' with '$(MSBuildProjectName).exe' all that did was name the output folder '$(MSBuildProjectName).exe' and not the actual project solution name.
In Over My Head. Any help is greatly appreciated.