Create file in the directory

Try using PostCustomCommand and run a batch file there which creates the .ignore file.