I am trying to solve the issue of my site's dll being locked on deployment. Reviewing this article: https://weblog.west-wind.com/posts/2022/Nov/07/Avoid-WebDeploy-Locking-Errors-to-IIS-with-Shadow-Copy-for-ASPNET-Core-Apps I wan to use ShadowCopy to help with this problem. I can make this work with .Net 8, where ShadowCopy is a real feature, but in .Net 6 its experimental.
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyProject.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
<handlerSettings>
<handlerSetting name="experimentalEnableShadowCopy" value="true"/>
<handlerSetting name="shadowCopyDirectory" value="D:\Websites\MyProject\ShadowCopyDirectory\"/>
</handlerSettings>
</aspNetCore>
</system.webServer>
</location>
</configuration>
And I have set permissions on my ShadowCopyDirectory folder. The IIS AppPool has full control over this folder.
BUT, when I deploy, nothing is created in this ShadowCopyDirectory folder. How can I make ShadowCopy work in .Net 6?