Change Visual Studio Emulator for Android vhd install path - visual-studio

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.

Related

Correct the file associations in the registry in windows 7 when a program is deleted

I have a windows 7 operating system and had installed Rstudio in the my documents folder (by just unzipping the .zip file) as I don´t have admin rights to my computer.
I then manually associated the file endings .Rproj .R and .Rmd with rstudio.exe by:
right-clicking on a file with that ending
selecting "Open with..."
Clicking on "Browse"
Going to the "bin" folder within my RStudio installation and selecting "rstudio.exe"
This worked fine, and the files opened automatically in RStudio when I double-clicked on them.
Over the following months, I updated RStudio twice but did not delete the old versions. Then I noticed that the files were always opening in the oldest version of RStudio (the first one that I had installed).
I decided to clean up, and deleted the two older versions.
At this point, the file associations dissappeared (as expected, since I had just deleted the program they had been associated with).
To associated them to the latest version of RStudio, I repeated the manual steps above, but hit a snag: after selecting rstudio.exe by clicking on the "browse" button within the dialogue box, the program did not appear as an option in the main dialogue box and I could not associate the file with it.
I searched for a solution here and elsewhere but was unable to find one with a complete set of steps that fixed my problem. I did note that this problem is by no means unique to Rstudio, and I suppose can happen to any file endings that have been associated with a program that you have deleted (as opposed to uninstalled?).
I had a suspicion that the path to the old version of Rstudio was stuck in the registry somewhere, but trying various iterations of assoc .Rproj in the command-line didn´t help me:
C:\Users\myusername>assoc .Rproj
File association not found for extension .Rproj
C:\Users\myusername>assoc .Rproj = rstudio
Access is denied.
Also, RStudio was not available in the Default Programs list (accessed from the start menu) and the affected file endings were not listed under File associations either.
I eventually found the solution using windows regedit - but since there doesn´t seem to be a post with the complete steps for this, I have posted it as an answer here, in case anyone else faces the same issue. I had to do this the point and click way, so would be grateful if anyone could provide a solution in the command-line interface, or provide some insight into why I got that "Access is denied" message (which occured even when I tried logging in with a temporary admin account).
It turns out I was right - the old file path was still associated to the file endings in the registry. I was unable to access or edit it from the windows command line prompt, but using the windows regedit program worked, as follows:
Go to the start button, type regedit and click on the regedit program icon to open it.
On the left-hand side menu in regedit, click on the arrow to expand the folder HKEY_CLASSES_ROOT
Scroll down the list to look for the file endings that have become unassociated (in my case this was .R, .Rproj and .Rmd)
Click on one of the unassociated file endings to see what details are recorded for it (these will appear in the right-hand panel of regedit).
See what it says under the Data column for your file ending (in my case, for .R it said “R_auto_file”).
This value (e.g. “R_auto_file”) is the key used to point to the program that will be used to open the file.
Now scroll further down the left-hand menu in regedit, past the zs and keep going until you find a sub-folder with the same name as the key you just identified.
Click on the arrow next to this sub-folder (e.g. “R_auto_file”) to expand it and expand the sub-folders within it (shell and open) until you get to command.
Click on command to view the details in the right-hand panel.
Right-click on the icon that says Default under the column Name in the right-hand panel and select Modify… from the menu that appears.
In the dialogue box that appears, under Value data: you will see an editable file path to the program being used to open the file.
This file path will probably be pointing to the old version of the program that you deleted.
Edit the file path so that it points to the new program, and click ok to save the changes.
Repeat steps 3 – 13 for all file types that have become unassociated.
Restart the computer for the changes to take effect.
You should now see that the files have the program icon next to them and open with the correct version when you double-click on them.
I had a similar issue with RStudio on Windows:
After installing RStudio with the installer I have updated to a newer version via the downloadable ZIP file and installed it into another folder.
Since then a double-click on .Rproj opened the old RStudio instead of the new one despite I tried to reassign the extension with the new RStudio.exe file
My solution was to change this registry entry via a Console:
reg add HKEY_USERS\<Windows SID>_Classes\Applications\rstudio.exe\shell\open\command /f /ve /d "\"C:\Users\Public\RStudio\bin\rstudio.exe\" \"%1\""
Please replace the in the code snippet above with your personal windows user ID. You can get your SID with
whoami /user
A SID looks like this:
S-1-8-21-667978445-1323479522-1885766523-895239
BTW: You could also use good old regedit to change the path (no local admin rights required!)

VSCode: moving files out of appdata directory

I'm on a company laptop and appdata has restricted storage space. An initial google showed there isn't really any settings to move directories. I was thinking of simply copying relevant directories i.e. \AppData\Roaming\Code to somewhere else, then creating a hard symbolic link (junction) with the same name and then point it to the same location
i.e. in command line:
mklink /J C:\Users\me\AppData\Roaming\Code C:\myFolder\Code
I played around with moving the whole appdata folder (right click on roaming/local/locallow then click on properties then location tab then change directory). I managed to only move half the files over. it seemed to work until i restarted and it caused chaos.
I don't want the same thing to happen again with vscode. (that said I haven't tried using a symbolic link for appdata
what is everyone's advice? can i create a symbolic link and have everything work fine? or will i cause more chaos again? if it works for vscode, i'd like to do the same for appdata too
Portable Mode in Visual Studio Code
You can use Portable Mode: After unzipping the VS Code download, simply create a data folder within Code's folder
After first launch 2 folders will be generated inside:
..data\extensions
..data\user-data
Then you can copy your company folders with files from
%APPDATA%\Code\User\
Then copy the extensions directory to data:
%USERPROFILE%\.vscode\extensions
Portable mode is not supported if you install VS Code. It is only supported if you get the ZIP download.
Symbolic links should work, but you can also tell VS Code to use a custom extension and user setting location with the --extensions-dir and --user-data-dir flags respectively
$ code --extensions-dir "/User/me/vscodeExtensions" --user-data-dir "/User/me/vscodeData"
There are some key limitations to this approach, such as extension updates not working. We are tracking support for a truly portable VS Code here: https://github.com/Microsoft/vscode/issues/329

How to create Explorer Shortcuts to specific TFS 2010 Source Control Paths

We are slowly moving projects from old file based storage (don't ask) to tfs. Our coders are still used to find the code in the file System.
Since we are talking about 100 Projects each with some sort of history, we have to move them carefully one by one. Resulting that we will have to live for some time with the already existing file structure mixed with the TFS managed files.
To make life easier for our coders, I would like to create a shortcut in the filesystem, for each project that we moved. So the developers can look up if the Project has already been moved, and if yes, go by double click to open up the TFS Source Control Explorer pointing directly to the correct Project.
Is this possible? Thanks for your Response.
I found a simple solution for my needs, which is based on a small batch script, that you'll have to click. It's not a shortcut so to say even though you can still create a shortcut of the batchfile.
Here's the script:
CALL "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
REG ADD "HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\<GUIDofTFS>" /v "SceMostRecentPath" /d "$/<PathToTfsProject>" /f
devenv /Command View.TfsSourceControlExplorer
In fact I combined 2 ideas found in separate sources:
1. Start VS with Source Control Explorer
2. Manipulate Registry to open Source Control Explorer in a specific path
With the command devenv /Command View.TfsSourceControlExplorer you can actually start VS and automatically open Source Control Explorer. Unfortunately there is no way to give a parameter to point it directly to a location you wish. But I noticed that VS2010 seems to persist the last used path and reopens to that place on restarts. A quick research resulted in the registry entry
HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\058104ed-f0e2-4126-9ccc-0e37e19c4f91\SceMostRecentPath
By manipulating the value of SceMostRecentPath you can trick VS2010 to open Source Control Explorer with the path in there.
Keep in mind: You will need to replace 058104ed-f0e2-4126-9ccc-0e37e19c4f91 with the GUID of your TFS Installation.
Since we are all using VS 2010 but the installation paths differ, I implemented the path dynamically by making use of the VS100COMNTOOLS variable. First we set up the TFS command line environment:
CALL "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86`
Then we change the registry:
REG ADD "HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\[PutYourTfsGUIDHere]" /v "SceMostRecentPath" /d "$/<YourTfsPath>" /f
Finally we do a simple call of devenv.exe with the source Explorer command:
devenv /Command View.TfsSourceControlExplorer
Until they're mapped to a local file path, I don't think this is possible. Though there might be an undocumented way to craft a vstfs:///VersionControl/LatestItemVersion/{itemid} link that might work, I haven't been able to craft one that does the trick.
You could create a powershell script that would check for the local mapping, otherwise ask them where they want to put it and setup the mapping, do a get-latest and go from there...
A bit of trickery with the tf commandline should get you pretty far.
tf workspaces /owner /collecion /computer to see whether there's a local workspace to the right team project.
tf workspace /new /collection to create one if needed
tf workfold /map to create a folder mapping, you could prompt them for a target location
tf get to fetch the latest sources.
Place the .ps1 file in the folder and when opened check for the workspace, if it's there open the local files in the mapped folder. if it isn't, go through the workspace mapping process by invoking the right commands.

Custom setting at un-install for file/folder deletion

Using Advanced installer for my java based application, it is working very good. I want to remove one folder and one file when user uninstall the application from system. Now my question is
1) how to remove a file from a given location e-g i have an abc file at desktop and i want if it exist there it should be deleted while user will uninstall the application(file will be on the same path and with same name for all) ?
2) how to delete a folder from the system while user uninstalling the application ?
3) if (2 i-e folder deletion) is possible then, can i change the location of the folder(i want to delete at uninstall) programmatic-ally ?
Thanks in advance.
Assuming your are using the latest version of Advanced Installer.
1) You can go to Files and Folders page and from the toolbar, under "File Operations", add a File Removal, which you can configure to run during install or uninstall
2) Right click on the desired folder and go to "Operations" tab, there you will find the options you need
3) Yes, you can specify the path programmatic-ally, but you need to do it from the beginning of the install process, using a property based folder. So basically you create your property based folder and configure options from Operations tab for it.

VS Setup project: install files in different directories

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.

Resources