USERPROFILE as Default Location - visual-studio

Can one use a folder that includes USERPROFILE as Default location in Visual Studio setup?
By default it shows as
[ProgramFilesFolder][Manufacturer]\[ProductName]
Changing [ProgramFilesFolder] to [USERPROFILE] like the one shown below doesn't seem to work
C:\Users\[USERPROFILE]\AppData\Roaming\CarriageWay
It does creates create a folder but it doesn't go to its intended target, totally ignores the "userprofile" name, say Ricardo for one. It may be any name.
C:\Users\AppData\Roaming\CarriageWay
Any ideas?

As it turned out, one needs to include "User's Application Data Folder" under File System on Target Machine [AppDataFolder] and add folders under that.
Not to be confused with the Default location under Applications folder.

Related

What is the path of "my computer" folder on windows?

I am working on a C++ windowsform project, using visual Studio IDE.
I use CFileDialog class to ask the user to select a file to open.
It display an usual open file selection windows.
I would like the default folder displayed to be the same as the one accessed when clicked on "My computer", where the harddrives, USB drives, dvd drives etc. are displayed.
I can define default folder by writting its path tolpstrInitialDir member, but I don't find the path for such a folder. I tried "\", "explorer.exe", "", none of them gave me the expected result.
The application will be used by several users, so the solution must not include the user name in the path. i.e "C:\Documents and Settings[user]\Desktop\My Computer" may work but is not correct for my application.
Does anyone know of to define the "root" path of windows (i.e the root of C:\) ?
I searched on SO and internet but maybe I have used wrong keywords because I couldn't find appropriate content.
My Computer is a virtual shell folder that doesn't correspond to any file system directory. There's no file system path that would correspond to that location.
Fortunately, file dialogs do speak "shellese", so you can use the CLSID (not to be confused with the GUID KNOWNFOLDERID or the CSIDL) of the shell folder. Sample in C# Winforms, but really, the only important part is the ::CLSID):
var ofd = new OpenFileDialog();
ofd.InitialDirectory = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
ofd.ShowDialog();
Disclaimer: I couldn't find any relevant documentation for the virtual folder CLSID, or this behaviour of the File dialog. So this is most likely not contractual, and could possibly change in future versions of Windows.
In the explorer, in the search bar copy the address of
This PC
and then select the text
This PC
and paste. Normally we get the
Ce PC ":: {CLSID}"
and then just copy
:: {CLSID}
and paste it wherever we want.
Path should be: C:\Users\UserName\Desktop\Computer.lnk

IIS Express 8 - Cannot write configuration file

I am trying to use IIS Express 8 for a MVC site in VS2012. I am getting the following error whenever I attempt to create the site:
Filename:
\?\C:\Users\xxxxxx\Documents\IISExpress\config\applicationHost.config
Error: Cannot write configuration file
Is there some way to force IIS Express to use a different location for the config & logs folders? I understand I can point to a different location when I am running iisexpress.exe from the command line, but I have no control over this when using Visual Studio.
Alternatively, has anyone got any suggestions why the error is happening? (Side note: My laptop is in a corporate environment which has some stupid encryption on the "Documents" folder, however I haven't had any problems with other software that saves to this location. I also have given the "Everyone" group full access to the folder.)
EDIT - After following the instructions at http://learn.iis.net/page.aspx/1286/iis-80-express-readme/ I still can't seem to get this working. I've tried the following:
Added HKCU\Software\Microsoft\IISExpress\CustomUserHome registry key pointing to my alternate directory
Added HKCU\Software\Microsoft\IISExpress\8.0\CustomUserHome registry key pointing to my alternate directory
Added HKLM\Software\Microsoft\IISExpress\CustomUserHome registry key pointing to my alternate directory
Added HKLM\Software\Microsoft\IISExpress\8.0\CustomUserHome registry key pointing to my alternate directory
Setting the %IIS_USER_HOME% environment variable pointing to my alternate directory.
Any other suggestions?
#Brad
I had your same problem just now. Removing the encryption on the IISExpress folder and the "Read Only" attribute solved it. In my company Documents is also encrypted, but I don't think removing that encryption from IISExpress would be a problem of any sort.
Hope this helps.
I had a very similar error message caused by a completely different problem.
The Error:
C:\VS\TFS_Projects\SomeSolution\SomeProject\SomeProject.csproj : error : Creation of the virtual directory http://localhost:55063/ failed with the error: Filename: \\?\C:\VS\TFS_Projects\SomeSolution.vs\config\applicationhost.config
Error: Cannot write configuration file due to insufficient permissions
More Details: I couldn't even open the project, as opening it would fail.
I could get prior changesets, and they would actually open fine, but if I got latest the projects couldn't be opened.
Solution: In my case, it turned out that when we changed TFS servers, someone had added the ".vs" folder to source control along with everything else. Under which, one developer had his applicationhost.config set up to run sites on a D:\ drive, while I had no such D:\ drive (well, it was a DVD drive.) I was able to get this working by finding a prior changeset with the un-altered applicationhost.config and replacing my local file. (I could have attempted to actually delete the folder, but I didn't go that route.)
Afterwards, we removed the ".vs" folder from source control.
(I put this solution here because it's where google landed me, so other people having this error message might find the above solutions don't fix it for them, and thus they might be having this problem.)
I'm also in a corporate environment with Encryption on the users folder, and removing encryption and removing the read only flags on everything in the IISExpress folder worked for me.
I'm using Visual Studio 2017 on Windows 10 and to fix this problem I had to disable the OneDrive setting "Save space and download files as you use them". After changing the setting my computer crashed but after rebooting I was then able to change SSL Enabled and everything worked.
For anyone googling this; this might be the same problem as this: http://connect.microsoft.com/VisualStudio/feedback/details/878812/use-iis-express-is-broken-in-vs-2012-on-windows-8-1
You can check it by downloading Prcocess Monitor and run it with a filter for "Path" contains "\Documents\IISExpress\config" and then try to change the project to use IIS Express. If there is a CreateFile entry with the result 0xC0190052 as one of the last entries then this is the same issue.
After struggling with this, and verifying encryption and read-only attributes, and having them not work, my solution ended up being:
Navigate to the folder containing the IISExpress folder (in my case, it was in my OneDrive, not Documents folder)
Right click on IISExpress folder > Security tab > Advanced button
Change Owner to yourself, even if it already is
Check the "Replace owner on subcontainers and objects" box
This may not appear until you've completed the Change owner dialog
Open the IISExpress folder
Right click on config folder > Security tab > Advanced button
Add a user > Add principal
Change location to local machine (and not a domain)
Enter the name NETWORK SERVICE and "Check Names"
Press OK to get back to the Advance Security dialog
Make sure to check "Replace all child object permission entries with inheritable permission entries from this object"
Worked in Windows 10 with IISExpress 10, for both VS 2013 and VS 2017.
C:\Users\xxxxxx\Documents\IISExpress\config\applicationHost.config
Uncheck the read-only attribute from the file. It worked for me.
Adding the registry entry seemed to work, however, using environment variables in the registry entry did not. In my environment only our documents directory is redirected, so I simply wanted to move the IIS Express config directory up one level to the %USERPROFILE% directory. However, that did not work. IIS Express read the environment variable literally and of course failed to run.
I had the same issue before, running VisualStudio as Administrator (Run as Administrtor) resolved the issue.
I also had the problem and tried to fix it with setting the registry key in HKCU\Software\Microsoft which didn't work.
The error I made, was using HKCU because, since I do not have permissions to edit the registry under by normal account (which I use to run visual studio), I was using an administrative account. Then of course, HKCU was for that account.
So I just used HKEY_USERS\"my normal user's SID" instead and, when starting iisexpress.exe manually, it created its files at the location indicated. What still didn't work was using iisexpress from visual studio. It still seemed that VS didn't use the registry setting at all.
Finally I resorted in setting a non UNC path for Shell Folders\Personal and User Shell Folders\Personal in HKU\"my normal user's SID"\Software\Microsoft\Windows\CurrentVersion\Explorer\ which did the trick.
I received the same error but in a different context. Opening a project (.csproj file) provided by another developer returned this error and failed to do anything:
Creating of the virtual directory http://localhost:58753/
failed with the error:
Filename: \?\C:\Users\xxxxx\Documents\Clients\xxx\Gen
II\xxx\,vs\config\applicationhost.config
Error: Cannot write configuration file
I removed both Encryption and the R/O attribute from the directory containing the project files and applied to all subfolders and files. Visual Studio can now read the project.
In my case I moved the folder to another location, so I had to edit the applicationhost.config file and changed the virtualdirectory entry to the new location. Removing encryption and setting read only off did not help. I imagine if I had just copied it instead of moving it, it would have happily continued working.

Adding files to all users 'My Documents' folders in Windows

I am creating an installer (using Inno Setup) for a windows application. The app has initial documents that I need to store in the users 'My Documents' folder.
Here is the issue, I install it as an Admin, but there may be one or many non admin users on that machine. How can i add that same folder to all the possible current (and future user's) My Documents folder?
Here is what i have tried so far-
1) I could try to pick up all usernames - This however, wont work for future user creations :(
2) I have tried to add it to the systems %allusersprofile%\Documents folder. It does not get reflected to individual My Documents folders.
I believe there should be a way, but have been unable to find a clean solution off the internet till now. Can anyone direct me towards the right path?
Mucho Thanks!
There isn't really a construct for this in Windows. You have a few options:
Put the document in some common place (like %allusersprofile%\Documents, or %program files%\yourCompany\yourApp\documents) and create a start menu link/icon that points to either the folder with the documents or the document itself.
Put the document into the Default User documents folder. When a new user is created, their profile is setup to mirror that of the default user. This doesn't help you with current users, but it does help you for users who haven't been created (logged on)
I'd go with option 1 because it's relatively standard and its what your average user is going to expect.
Look at Inno Setup Shell Folder Constants : {commondocs}

MSI Installer and custom folders

I have an interesting problem. I created a MSI Installer for a .NET 3.5 Application. During the install process I ask the user for a custom folder name where application output files should be stored.
To solve this task I have added a "Textboxes A" user interface item. I assigned TextBox Edit1 a property.
This property I used in "Registry" view to store that path in the registry - that worked. But:
I also used this property in the "File System" view to specify the target folder.
The result is: registry is stored correctly. But the installer created always a directory which is named like the default value of the Textbox Edit1. I've changed that name to ensure that there is no place where I could get that value.
I seems that the property is not being updated by the installer UI although the registry value is set correctly.
Does anyone had the same or similar troubles and found a solution/workaround?
Thanks, Arthur
EDIT: If I change the order of the UI Items (Ask for custom folder first, then ask for the target folder) it works. But this is - what should I say - not a solution. It's a sad workaround.
EDIT: With Edit1 I mean the Edit Control 1 of the "TextBox View A" which is bound to the Property "DATAFOLDERPROPERTY".
A verbose MSI log should tell you more about what exactly is happening. There are two things that jump out at me. One is that your property, Edit1, is not a public property. For it to be public, all letters must be upper-case, e.g. EDIT1. The other is that you are trying to edit a folder location after CostFinalize has set directory locations. To update directories at this time, you cannot merely change their associated properties. You need to add a Set Directory custom action (type 35) to the sequence or a SetTargetPath control event to the dialog - I'd use the control event if possible.

ASP.NET Web Setup

I have 3 web projects in a Visual studio solution.I want to create a single web setup project which should install all 3 web projects in their virtual directories.So how to create a single web setup project which supports multiple web application installation?
You can do this by creating a Web Setup Project. In the File System add as many Web Custom Folders as you need.
Only the main Web Application Folder will have the installation dialog so if you want to customize the virtual directory names then you will need to add a screen and set the Property of the web custom folder to be the same as the field name on the screen you add.
I never found the whole "web setup project" concept to work well. For starters, I've never managed a web server where the only site configuration was the default web site, so the "out of the box" functionality of defining a virtual directory to be created on the default site never worked for me, and it doesn't sound like it would be very useful to you either.
The best option I've found is to create a standard setup project that installs the output + content files of each web site into a \\Website path (or similar) and write a custom installer action with a supporting GUI that allows the installer (user) to select the proper web site and specify the name of the virtual directory to be used.
As John Hunter said, it is possible to add multiple Web Custom Foldsers beside the default Web Appplication Folder. But you need to know some details about how things add up.
One thing to notice is that the Property name you set for the additional folder will be the physical path of the installation. This however is read only in your setup logic, because it is automatically set later as the location of the IIS default path (typically C:\intepub\wwwroot\) added with the value specified in VirtualDirectory on the folder properties. So what you need to set in the custom screen you add, is not the Property name defined on the folder, but the property name that is used for the virtual directory. This is the Property name you specify appended with "VDIR". So if the property name you specify for the web folder is "WEBSITE1", then the property name for the virtual folder will be "WEBSITE1VDIR". In your custom screen, you then need to set up the property name for the text field you use to "WEBSITE1VDIR", The default value in this textbox will be automatically populated with you default VirtualDirectory value specified on the folder.
If you choose to remove the default Installation Address dialog so you specify also the main web site in a custom text box on the same page as the others, you need to know that the property name for the physical path as you see grayed out is fixed to "TARGETDIR" in the Property name for the "Web Application Folder". However, the property for the virtual path is not "TARGETDIRVDIR" as it would be if it followed the same name convention as the other, but it is "TARGETVDIR".
But if you do remove the default Installation Address dialog, you loose the option to select the web site to use (typically "Default Web Site") and Application pool from drop downs that shows you what is available.

Resources