I have a large folder structure with a ton of subfolders that I am using for application data in my UWP app. When testing, I can just have it sitting on disk and it's fine, but when I make a store package, I need to be able to copy that data in. The only way I've found to include assets is to manually add individual files into Visual Studio and set them to be "Content". Is there a way to copy in an entire folder as "Content" and preserve its folder structure?
You don't have to manually add all the files. Add the entire folder inside the UWP app folder. Once you do that you should be able to use the Show All Files option in the solution explorer and add the entire folder. If the property of the added files is not already set to "Content", multi select the files and set the Build Action property in the Properties window to Content
[]
[]
Related
I've been dragging a few assets into my project in Xcode, and while I know you can check that box for 'copy items if needed', that doesn't always show up and so I end up with files that are located in scattered locations on my hard drive. I know I could manually put the files in the project folder, but is there no way to automatically copy external files to an internal location?
I want to avoid duplicating 400+ files in the Assets folder of my UWP App project folder. I want to tell VS to take files from an arbitrary location in my source tree, and use those in the Assets folder, preserving folder structure etc for deployment. I don't even mind setting the pathing manually in the project file properties if I must.
Is there a way to do this? The best I got was to right click on Assets\BlahFilter -> Add -> Existing Item. This results in the file appearing in the Solution treeview in the place I expect, but when deploying, the file appears in the root of AppX folder, ignoring any subfolder (filter) structure specified above.
I fixed this. You can use a "Custom Build Step" and treat the output as content. This will result in VS packaging that output directory's contents in the final AppX package. You can specify a folder, and all sub-folders will be automatically copied. The build command can be blank, or something innocuous like 'echo "blah"'
I have a folder in my /Content folder which is not being included when I build and publish my website. Only the standard CSS, Images, Scripts and themes folders have been included. I also have a Downloads folder containing .doc files that has not been included.
Am I limited to the standard set at the level below /Content?
Empty folders typically don't get deployed.
For the Downloads folder, what's the "Build Action" set to for the items that it contains? They should be set to "Content" for anything that you want deployed. This isn't automatically set for some file types, such as PDF, etc.
The only items that get deployed have to be both referenced in the project (that is, they have to appear in the solution explorer, not just present in the folder on disk)
, and have the correct build action set.
You might also set the "Copy To Output Directory" setting to True and see what happens.
In Visual Studio, right click on every folder underneath /Content folder, and choose Include In Project. Else, the files are only physically there on disk but the project doesn't know they are there and doesn't publish them.
Hi
In order to be able to work with e.g. picture, I need to click on Resources.resx and Add Existing Item.
Then it will appear under Resources folder. However I could use Context menu on that Resource folder and add existing item as well but then I cannot work with it and it is not displayed when I use the Resources.resx file.
So I always need to click on Resources.rext when I want to add anything? Also in this "view" I cannot use folders so its pretty messy.
Also what is New Folder in Resources dir good for - when I drag files there, there are not accessible anymore..
Correct; to add something to a ResX file, you need to add it to the ResX file.
Instead of folders, you can use multiple ResX files.
You can also embed images in your assembly (set Build Action to Embedded Resource) instead of using ResX files; you can then create arbitrary directory trees.
To read embedded resources, call typeof(MyType).Assembly.GetManifestResourceStream(name) and remember to close the stream in a using statement.
I know I can add a icon to the Resources.resx file of a project and then reference that icon from within the code.
How do I set the icon of the entire EXE from the resources? All I see is a place to browse for another file. I want to use the current icon file that I have in my resources and not have to have a duplicate file in my project...
thanks
The way that the adding of an application icon is that you must select it from the local file system, and then it is embedded into the application at build time. As far as I know it is not possible to have it first pull from a resource file.
One solution I always use to prevent duplicate file references, is to create a solution folder such as "Project Dependencies". And then all refereces are made from that folder, so when building it pulls from the Project Dependencies folder.
This would work for resource files also, just copy them to the solution folder first and then drag them into your resource.
And for the assembly icon, just browse to the Project Dependencies folder as well.
Good Luck!