Automatically create folder in Csharp project with audio files

Asked

Viewed 40 times

1

I have a project in C#, created a folder in the project by Visual Studio 2019 and put 2 Ogg’s there. The structure is as follows:

  • App
    • Assets
    • Files (this is the folder I put the audio files in)
    • Model
    • View
    • Viewmodel

I have a question, every time I compile to test the application (CTRL + F5) it does not create any folder in the bin/Debug project, ie, the folder I created in the project is not being replicated when I compile the Debug.

I know I can create the folder in the application with the command below:

    var path = Application.StartupPath + @"\Files\";
    if (!Directory.Exists(path))
    {
          //Se não existir cria a pasta na raiz do projeto
          Directory.CreateDirectory(path);
    }

The problem is that the audios do not go to the folder and they are fixed audios, do not change, I already want the application to play those audios when the application opens.

Someone can help me?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.