Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Dynamically Get Project Solution Name in Nlog.Config file

$
0
0

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).exe

However, 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.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>