I've created a C# ASP.Net web API project that requires 2 folders to exist in the remote server in order for the API to run:
- "UserFiles"
- "UserFiles/PurgeFiles"
Following the advice given in this answer and this answer, I've added this to my API.csproj file:
<Target Name="CreateUserFilesFolder" AfterTargets="AfterPublish">
<MakeDir Directories="$(ProjectDir)UserFiles" Condition="!Exists('$(ProjectDir)UserFiles')" />
</Target>
To try and create the UserFiles directory, for example, but it doesn't work.
I've tried updating it to Directories="$(PublishDir)UserFiles" and even $(MSBuildProjectDirectory)UserFiles figuring that was the issue, but it's still not creating the empty folder.
What should the lines in my .csproj look like or do I, perhaps, have to define PublishDir or something similar somewhere to get this to work?