简体   繁体   中英

How to copy a file to output folder without modifications? Visual C#

I would like to publish a project with a mp3 file in the application folder, so that I can use it when app is running. Is there some way to do it?

My current attempt is to click on the mp3 and drag it to the "Solution Explorer". When the program is published, the output folder does have a "play.mp3" file, but it is named "play.mp3.deploy", which turns it unusable

If this is a forms app then add the mp3 file to a resource file (resx) and access it that way.

If the app is a website you should be able to mark the file properties as Build Action = Content and Copy To Output Directory = Copy Always. This should then just get deployed in the same manner a js file would for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM