Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild create folder if folder does not exists

Similarly to this question, but rather than creating a file if it doesn't exist - I want to create a folder, if it doesn't exist.

like image 556
SpiritBob Avatar asked Aug 25 '26 22:08

SpiritBob


1 Answers

MSBuild create folder if folder does not exists

To create a folder if folder does not exists, you can use the below xml code:

  <Target Name="MakeMyDir" AfterTargets="PrepareForBuild">
    <MakeDir Directories="$(ProjectDir)Newfolder" Condition="!Exists('$(ProjectDir)Newfolder')"  />
  </Target>

Newfolder is the name of your created folder.

like image 143
Mr Qian Avatar answered Aug 29 '26 11:08

Mr Qian