Adding this:
<ItemGroup>
<Content Include="AppData**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
to your .csproj
file will copy AppData
folder if it's not empty. For empty AppData
folder you can use this workaround:
<Target Name="CreateAppDataFolder" AfterTargets="AfterPublish">
<MakeDir Directories="$(PublishDir)AppData" Condition="!Exists('$(PublishDir)AppData')" />
</Target>
This will create AppData
folder after publish if it won't be already included in output. Meaning this will create AppData
folder only if it's empty while publishing.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…