0

I have a c++ project in visual studio and a folder called assets, in the same location as the source file, that contains folders for music, sound effects and images that my c++ game uses. That folder must be placed in the same folder as the .exe file of the game.

I have created a deployment project for the c++ project. However, it seems like I need to manually add these folders (assets, images, music, etc.) and files to the File System on Target Machine.

Is there a way for visual studio to add these folders and files automatically?

I have not managed to find anyting online for how to do that so far.

Thanks.

Seb0029
  • 69
  • 8

1 Answers1

1

This link provides many methods. You could drag all the files you want to add into the file system view. Or you could right click on the folder in explorer and click copy and then right click the folder in the file system view in the setup project and click paste.

Barrnet Chou
  • 1,738
  • 1
  • 4
  • 7
  • Thank you. Would you know what the destination folder is for the deployment project? I tried the xcopy command with the destionation pointing to the Release folder of the deployment project where the setup.exe and .msi files get created but no files got copied there. I entered: xcopy C:\Users\abc003\source\repos\game1\game1\assets C:\Users\abc003\source\repos\game1\game2-setup\Release. I need these folders to be installed together with the game when you run setup.exe in the same location as the game installation directory. – Seb0029 Aug 10 '20 at 21:14
  • I revised the answer and hope it will help you. I think you may want to deploy a C++ application. You could refer to this [link](https://learn.microsoft.com/en-us/cpp/windows/walkthrough-deploying-a-visual-cpp-application-by-using-a-setup-project?view=vs-2019). – Barrnet Chou Aug 11 '20 at 05:40
  • Thanks Barrnet! I had already created a deployment application. My question is how do I automatically add folders and files to the File System (right-click on setup project, View, File System). I can manually create folders and manually add files there and they are then included in the setup.exe and .msi when I compile and they install fine. But I don't want to have to manually add folders and files each time. I'm trying to find how and where do I automate that? If it is at all possible. It's not working with xcopy. I think that is for something different than what I want to do. – Seb0029 Aug 11 '20 at 16:36
  • Do you mean that you only installed the programs in VS after executing the setup program and did not install the files you added? – Barrnet Chou Aug 12 '20 at 05:59
  • When I build the setup project it only creates a setup.exe and .msi files, both in one folder. When I run the setup.exe it also installs the files and folders, containing the assets for my game, I added to the File System. I can add files and folders manually to the File System but I'm trying to find a way to add those automatically. Because as I work on my project, many more files and some folders will be added and I don't want to keep adding those each time manually to the File System. – Seb0029 Aug 12 '20 at 11:09
  • I hope this will solve your problem. If your problem is solved, I would be very grateful for you to mark it. – Barrnet Chou Aug 13 '20 at 06:53
  • Thanks Barrnet. Sounds like what I am trying to do. I need to see how to set this up though because there are a few gaps in the answer at that link. Why does VS not have a native function for this? It's basic functionality: automatically inlcude a directory in the setup.exe. I think any developer would want that as a given. Once I get this working I'll mark your answer as the answer to my question. Thanks! – Seb0029 Aug 14 '20 at 11:40
  • The solution at the link you provided mentions to add a new ItemGroup but does not say how, and I cannot find online how to add a new item group. – Seb0029 Aug 14 '20 at 11:57
  • I suggest that you could refer to this [link](https://learn.microsoft.com/en-us/visualstudio/msbuild/importgroup-element?view=vs-2019) to learn `itemgroup`. – Barrnet Chou Aug 17 '20 at 05:52
  • Thanks for your help Barrnet. The link does not say which settings to click on in Visual Studio. Sorry but I give up. I cannot find anything online that says where to go in VS. I understand the code I have to type but have no idea WHERE to go in VS to type that code. – Seb0029 Aug 17 '20 at 13:47
  • Why don't you copy or drag files directly? – Barrnet Chou Aug 18 '20 at 01:19
  • According to your description, it is better to copy or drag files. – Barrnet Chou Aug 18 '20 at 01:37
  • Yeah. I wanted to automate that but it won’t be much manual work for the size of the project I want to do. I think Microsoft could have provided a function to automate that. They have clear instructions on how to do it manually and I have tried that and it works. – Seb0029 Aug 18 '20 at 11:37
  • I am afraid that there is no function to automate it. – Barrnet Chou Aug 24 '20 at 07:01