VS Setup project: install files in different directories - visual-studio

I have Visual Studio Setup project. And I want to install one of my file to some directory on drive C. How am I supposed to do it?
An example:
I'm installing my app in C:\MyApp. And one file, settings.ini, to C:\Settings\MyAppSettings\

You can try using the WindowsVolume property:
go to File System Editor
right-click the "File System on Target Machine" tree item and select "Add Special Folder" -> "Custom Folder" context menu
rename the new folder to something friendly, for example "C Drive"
select the folder
in its Properties pane set DefaultLocation to [WindowsVolume]
in this custom folder add the folder structure you want (MyApp, Settings etc.)

As this turned up quite high in the Google results - anyone looking to put the file onto a drive that is not the Windows volume (ie a network drive, or if Windows is not on C drive):
Follow the answer provided by #Cosmin above (add special folder in installer's file system), but put the literal drive path in.
Eg set DefaultLocation to c:\MyApp or z:\desired\location.

Related

Change Visual Studio Emulator for Android vhd install path

Is it possible to change the default path that the VS emulator is storing the .vhd files? By default it's set to store them under my %LOCALAPPDATA% folder, but that's on my C drive and I'm running out of space on C.
How can I set it to store them in D:\emulators?
#Ionian316
1/ Open regedit.
2/ Go to: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudioEmulator\Android\Configuration\
3/ Find file UserConfigurationPath
4/ Input your path in here:
Default path is: %LOCALAPPDATA%\Microsoft\VisualStudioEmulator\Android
New path example: D:\VisualStudioEmulator\Android
Of course, you should copy from default path to new path for not be error.
EDIT 1
There is a solution pointed in VS Emulator for Android troubleshooting (link):
Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the folder tree on the left.
Modify the Path registry variable to match the path to your Android SDK.
However, this solution seems out-of-date for current available VS Emu 4 Android versions. I can not find the registry folder in the tree.
EDIT 2
Here is a simple way to do, by which I managed to change the root Path of vhd.
Situation 1: Already installed
Rename folder %USERPROFILE%\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\ to something else, for backup.
Create folder D:\emulators.
Open cmd command-line, type in MKLINK /J %USERPROFILE%\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\ D:\emulators, press Enter.
After junction made, move everything in backuped vhd folder to D:\emulators.
You've done.
Situation 2: Not installed yet
The steps are similar to those in Situation 1, but you do not need to rename for backup, nor move the backuped stuff to D:\emulators.
You just need to make the junction, and then install VSEmu4Android.
EDIT 3
NOTE:
For proper usage of vhd's in Hyper-V (which is used by VSEmu4Android), your D:\emulators folder and files inside should not be compressed.

Why is Visual Studio creating two DLLs with the same name in the bin folder?

For some of my Visual Studio solutions it is creating two DLL files in the bin folder which both appear to have exactly the same name, but when I look at their properties one is an 'Application extension (.dll)' and the other a 'CONFIG File (.config)'.
Why do they both have the same name and why isn't the config one called 'ProjectName.config'?
The file names created by VS are ProjectName.dll and ProjectName.dll.config.
If you are using Windows, it is most likely hiding common file extensions. This makes it appear that the files have the same name. To see the actual name:
Open the folder in Explorer
Navigate to View -> Folder Options -> Advanced
Clear the checkbox for the option "Hide extensions for known file types"
Now you should be able to see the full name of the file along with any extension. More details are available on the following page: Show or hide file name extensions.
For more information about .config files, see Configuration Files.

Folders not showing up on disk from XCode

I added a folder to my project in XCode and called it Themes, which will be used to store themes for my iPad app. Under that I have Red,Blue, and so forth.
They show up in XCode. But when I look at the physical folder, there is no Themes directory (and obviously anything under it).
Why not? Where did it go? How can I store images (which may have same names) under different paths (themes)?
Thanks in advance
XCode does not create "folder", it creates "groups". Groups are logical organization of your files, independent of the file system organization underneath it
If you want to actually have a folder, easiest way would be to create one on the file system first (through Finder), and then drag it to XCode's project navigator. When a confirmation window pops up, leave the default settings ("Copy items into destination" and "Create groups for any added folders")
This will import the folder and all the files in it, however it will not auto-import newly added files to the folder after this (you'd have to manually add them).
If you do want to auto-import newly added files from the file system's folder to this group in XCode, instead of using "Create groups for any added folders", change to "Create folder references to any added folders"

Visual Studio Installer: How to Target Windows Public Documents Folder?

I am creating a desktop app that needs to install an SDF file to the SpecialFolder.CommonDocuments folder (C:\Users\Public\documents in Win 7). In a Visual Studio desktop Deployment Project, how do I specify this folder in the File System Editor?
I tried creating a custom folder in the File System Editor and pointing it to the CommonDocuments folder in the Properties pane, like this:
Unfortunately, that specification won't build. I don't want to hard-code a folder path, since it varies between Windows versions. So, how do I specify the CommonDocuments folder in the FileSystem Editor? Thanks for your help.
I figured this one out and documented it for internal purposes. So, I'll just reprint that writeup here:
Visual Studio deployment projects don't support the CommonDocuments folder directly, but we can add that support by using the Launch Conditions Editor, which has a "Search Target Machine" task. We will use the task to search the Windows registry for the path to the Public Documents folder and assign the result to an installer property (actually a variable) called COMDOCFOLDER. We will then use that variable to set the path to a custom folder in the File System Editor.
Here are the steps to perform the task. First, open the Launch Conditions Editor in a Visual Studio deployment project:
Right-click 'Search Target Machine' and select 'Add Registry Search' from the Context menu. A new item will appear (see 1 above). Name it Get Common Documents Folder. In the properties pane (See 2 above), set the 'Property' property (the name of our variable) to COMDOCFOLDER, set the 'Root' property (the Registry root key to search) to vsdrrHKLM, and set the 'RegKey' property (The Registry key to find) to SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders. Notice that we omitted the root key from the 'RegKey' Property. Finally, set the 'Value' property (The name of the value we are searching for within the registry key) to Common Documents. The COMDOCFOLDER variable will now hold the path to the Public Documents folder.
Next, go to the File System Editor in the Visual Studio deployment project:
Right-click 'File System on Target Machine' and select 'Add Special Folder > Custom Folder' from the context menu. A new item will appear (see 1 above). Rename the item Common Documents. In the properties pane (See 2 above), set the 'Property' property to COMDOCFOLDER. I set the 'DefaultLocation' property to the hard-coded value of the CommonDocuments folder for Windows Vista and later; this value would only be used if the COMDOCFOLDER property returned a null value, which shouldn't happen. The installer now has a Common Documents folder that points to the Public Documents folder, as specified in the Windows Registry.
There is more information in this Microsoft Support How-To.
The answer of David Veeneman is great! Helped a lot.
A little correction:
Right-click 'File System on Target Machine' and select 'Add Special Folder > Custom Folder' from the context menu. A new item will appear (see 1 above). Rename the item Common Documents. In the properties pane (See 2 above), set the 'Property' property to
[COMDOCFOLDER]
Those square brackets are necessary, otherwise you'll receive exception while executing the installer.

What is a solution folder in Visual Studio?

I have a Visual Studio 2008 solution, and I would like to include a real folder in the solution, but not at the project level, instead at the solution level.
I noticed you can right click the solution and add a solution folder, but it comes up as some white folder, and I have my doubts as to exactly what it is supposed to be...
Basically on the file system I have c:\mySolution\myFolder...
I want that myFolder is added to the solution, so that items are also under source control...
I also would like to be able to add physical folders to a solution, but unfortunately you can't do so outside a project.
The best solution I have found is to add a solution folder with the same name as the physical folder (myFolder in your example), then add files from that physical folder to the solution folder.
However Visual Studio does not maintain a mapping between the solution folder and the physical folder which means that:
new files subsequently created in the solution folder using Visual Studio are not automatically placed in the physical subfolder (I think they are created in the solution root folder by default)
files added to the physical folder are not automatically visible in the solution folder, even with "Show All Files".
To add new files, I therefore always create the new file in the physical folder outside Visual Studio, then add it to the solution folder using "Add/Existing Item"
What I have done historically is to create a project for just holding files (DLLs, etc.)
You can do that as well. This project can be named as whatever folder you are trying to create.
Follow this...
Create the solution folder from Visual Studio.
Right click the solution folder to create a new project.
Change the default location path to add the new physical folder name right after it with the back slash. Something like...C:\Project\Test\New Physical Folder
Click the OK button to create the project
Then the new project will be put inside your new New Physical Folder.
You can also add standalone files in a solution folder, and they will be source-controlled. But be wary that VS tends to put these files in the same folder as the solution file - the "Solution Folders" are virtual and don't corresspond to real filesystem folders. To have a real filesystem folders I think you would have to create the structure yourself and then choose "Add Existing Item".
From MSDN:
"If you are working with a solution that contains numerous projects, you can use Solution Folders to organize related projects into groups and then perform actions on those groups of projects."
You don't want what the composer meant in Solution Folder. It made them to organize large solutions into groups.
For your problem, I think this is the job for your Installation Project to collect these files: Installation instructions, Global help, etc...
You can use a solution folder to group files in a solution, but a solution folder doesn't represent an on-disk folder, like its logo suggests. (It can contain file references and project references.)
My prefered solution is to add a Shared project, which is like a folder but with a special icon.
Create your Solution
dotnet new sln -n demoProjectName
e.g. Your solution folder path C:\Projects\demoProjectName>
Create a Project within the same solution Path
dotnet new classlib -n Persistence
From your solution folder path, do this
C:\Projects\demoProjectName> dotnet sln C:\Projects\demoProjectName\ add C:\Projects\demoProjectName\Persistence\Persistence.csproj
Please note: Persistence as used is just a placeholder for your project name. classlib for classLibrary projects and it could be a console project and so on.

Resources