I want to add content to a web config, but only if that content does not already exist. This is what I do:
$webconfig = Get-Content F:\whatever\web.config
if ($webconfig -notlike "*WebGrease*" ) {
// do stuff here
}
Now my problem is: Even if the web.config contains something like
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
it still enters the code at "do stuff here". What is the problem? Doesn't "notlike" work with multi-line - strings?