I am trying to create a Windows runtime application (in c++) and I want to store some "external" files in the application's Assets. I figured out there is a 'Content' flag which makes the file included in the package. However, if files are not located in the solution folder, all the files from all subfolders go directly into the Assets folder, which creates a huge mess. I want to keep my source folder structure. This works if the assets are located in the solution folder, but this is inconvenient for me.
On Android, you simply specify any assets folder location, and this folder is packaged as is. Can I do something like this on windows?
This post sort of gives answer to this question: Assets folder for Windows 8 Phone app.
However it feels like almost nobody including me have that drop-down option on the Add button (I am using VS2013 Ultimate Update 4).
So is there another solution? Can I for instance edit the visual studio project by hands?
Add as Link is only available for C# and VB Projects.
Related
I am new to this coding world. So forgive me if any dumb question is asked or I made any mistakes
I am making a cpp tool which works well on my machine & also on others too. But inside it there is a function which works with some BAT & VBS files stored in a separate folder. Now the problem is when I am sharing the EXE file it is not working as the folder directory can not be found on other devices.
Now how can i solve this scenario? Is there a way to make installer for the console app which will copy the necessary files and folders in to the user's C drive? Or can I include the files into the EXE and extract them to a folder so the the program can use those?
Is there any possible solution for this ?
I am using Visual Studio Code & mingw gcc compiler for building the app
How about creating installer using setup creator(https://installforge.net). You can package multiple files in the installer and select installation directory to something like c:/program files/your_application_name.
That way your executable and other files will be in the same folder and it will also create a start menu shortcut
One straightforward solution I can think of is to include the dependency files with the exe when you share it to others.
Another way is to embed the dependency files as resource files into your executable when you build it in Visual Studio, then extract them when you run the exe (A little difficult to implement)
Or just create an installer like this
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.
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.
Why can't I add images to my UWP assets folder? I usually use C#, but I have to use C++ because I'll eventually be turning this into an optional package (somebody tell me if I'm wrong, and I can write optional packages in C#).
Using Visual Studio, I right click on the Assets folder in the Solutions Explorer click Add->Existing Item and then click on my image. It shows up in Visual Studio, but it doesn't actually get added to the Assets folder so I'm unable to view it when I load my app. I wouldn't think that it matters whether I use C++ or C#, but one is working and not the other.
I've tried rebuilding the project, rebooting the computer, repairing Visual Studio and I'm still stuck.
As suggested by paxbun, I tried using File Explorer to add the file. If I added the file in the Assets folder with the project files, it didn't help. I was able to get the code to work by adding the file to the AppX folder in the Debug folder, but this won't help when I'm ready to release (to make sure, I did a quick sideload).
I haven't put much at all in the code, but you can view it at https://github.com/benjasperson/SimpleCPPImage
Upon further research, I found my answer here.
Clicking "Show all files" in the Solution Explorer and then setting "Include in project" to true was all I needed to do.
I have been following some tutorials for c++ game programing. I am kind of new to c++ and I'm using Microsoft Visual C++ 2010 Express IDE. I'm working on creating a game, and when I run the program through the IDE, it shows the grass sprites as expected. But when I run the .exe file from the Release folder, it shows weird images. and when I run the .exe file from the debug folder I get a grey screen. Can anybody tell me why this is happening?
I hazard to guess that your sprite images are kept as data files in your project folder. With that I offer the following premise:
The default run-location from the Visual Studio IDE is the project folder of the project which you're executing. That is, normally it executes from the directory where your .vcproj or .vcprojx file is kept (and that is often one folder below your solution directory folder, where your .sln file is kept).
If your project runs correctly from the IDE, but fails to run directly from the release folder, it is highly likely you are relying on project data files (images in your case) that are kept along side your source files in the project folder. When run from the Release folder, those files are no longer visible because your the Release folder is your working directory; not the project folder.
There are a number of ways to solve this problem, each with its own merits. A few options are:
Post Build Step
Make a post-build step for your project that copies your data files to the $(TargetDir) location with your project. These files will then be visible in the same directory as your executable.
Benefit: Its easy.
Drawback: It will always run if you click "build solution" even if the data files are "up-to-date."
Custom Build Targets
Add your data files to the project and write a Custom Build script that performs the same copy, but also establishes an output dependency file(s).
Benefit: Almost as easy as #1, but a little more tedious.
Drawback: You may have a lot of data files and each will require its own custom build step. (Note: you can multi-select all the data files in your project, and if you're creative with the built-in macros you can have them all use the "same" build rules and commands).
Embedded Resources
Add the data files as custom resources to your executable.
Benefit: Your project no longer requires data files side-by-side with the executable since they are embedded in the resource table of your EXE module.
Drawback: Custom code is required to dynamically load the custom resources from your executable's resource table rather than off-disk. It isn't difficult at all to do, but is additional work.
There are other options as well, but I hope this gives you some ideas to start with.
I use VS2008 and try to answer your question. Right click on the project and select properties on the bottom of popup, then go to Debugging under Configuration properties. You can see command you run and arguments you pass in IDE. I guess you miss some parameters.
This might be a silly question but I am still learning. I have read several books on creating application and creating a good directory structure. When people talk about creating a directory structure, do they mean the folders you make within the solution explorer (folders you actually find inside of a .sln file) or do they mean setting up and creating folders that reside in the same folder as your .sln file or your compiled application (.exe). I figured the solution explorer folders are different from a typical windows folder cause the folders I create inside my .sln file are no where to be found on my windows system.
Visual Studio has a strange way of dealing with "folders" in solutions. A "Solution Folder" is not actually a physical folder, but more of a virtual folder managed by Visual Studio. Your files may end up in the root directoy, but VS will treat them as if they are in a "folder." This is configured and managed in the VS .sln or project file.
I'm not a fan of how this works in Visual Studio, I don't get why they don't just put files in physical folders. It's up to you whether you want to fight VS and try to keep your files in physical folders, or if you want to just let VS manage it, but ultimately, it really doesn't matter.
a typical directory struction will be like
bin (binaries)
Src
->.sln
->common
->.prj
->Project1
->.prj
->Project2
->.prj
Lib (3rd party lib's)
Doc (documentation)
Tools (3rd party tools)
Setup (setup projects)
Test (test cases)
With C++ in Visual Studio your solution directories need not match the filesystem, but they can.
Typically people refer to the directory structure as the filesystem layout of the project.
It's typical to have visual studio directories called headers and source, you wouldn't lay your project out like this on your filesystem though.
Visual Studio directories aren't just virtual folders though, they can contain filter rules so when you add a file to your project it will automatically get added to the correct filtered folder. They can also specify whether the folder should be under version control or not. And whether they should be parsed for auto complete or not.
Typically on filesystem I will create 1 folder per project and rarely create subfolders inside an individual project. But in the solution explorer I will create top level folders which I put projects into (For example: "Server Components" and "Client Components"), as well as in project folders to group things logically together (For example: Config, GUI, Controllers, ...) so I can find what i'm looking for faster.