I am really struggle to get this working. I can update the app settings using powershell but there is 1 line which i need to modify in Target node. Here is a portion of my xml
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,
EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient"
type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<targets>
<target name="f1" xsi:type="File" fileName="test.log.txt" layout="${threadname}
${longdate} ${callsite} ${logger}[${level}] ${message}" />
<target name="console" xsi:type="Console" layout="${threadname} ${longdate} ${callsite}
${logger}[${level}] ${message}" />
</targets>
<rules>
<!--<logger name="Quartz.*" level="Warn" />-->
<logger name="*" writeTo="f1" minlevel="Info" />
<logger name="*" writeTo="console" minlevel="Debug" />
</rules>
</nlog>
In the target node where it says test.log.txt I just want to have a file path with this like "c:projectlogs est.log.txt"
This is what i used for app settings and it worked
$webConfig = 'C:Projectsapp.exe.config'
$webConfigXml = [xml](gc $webConfig
$appSetting = $webConfigXml.configuration.appSettings.add | where {$_.Key -eq 'userName'}
$appSetting.value = 'testUser'
Struggling alot with this one
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…