I am building a project with .NET v6.0.401 on Ubuntu 20.04 and using Visual Studio Code. I have a folder with resources (images and sounds) that I use in the program, for this it is necessary that the files are copied to the output directorybin/Debug/net6.0/
.
I've seen tutorials on how to make the files copy to the folder where the binaries appear, but it's with Visual Studio on Windows.
My project consists of:
- Solution.
- Project 1 of type console that calls classes contained in Project 2.
- Project 2 (classlib) in which the resources (images and sounds) and classes are found.
Create the solution and the two projects from the terminal using dotnet
and I have already added the necessary references between projects and it works correctly.
Now, is there a command to make the folder with files be copied to the output directory when compiling? Any detail I should know?
If I run dotnet --info
I get:
SDK DE .NET:
Version: 6.0.401
Commit: 0906eae6f8
Entorno de tiempo de ejecución:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.401/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c
.NET SDKs installed:
6.0.401 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
The solution was to add the following code to the .csproj file for each image or sound to include: