I have a setup and deployment project in Visual Studio 2010
The default location of Application Folder is set to C:\[Appname]
The problem is that if there is no drive C: in the machine the app is being installed, the installer will crash with an error "'xxxxxxxx' is not a valid file name" or something similar, because the installer verifies the location before the user has a chance to set the actual application installation folder. (so the default location is validated and since drive c: is missing it throws this error)
You can set the location to something like [ProgramFilesFolder]\[AppName] etc..
I would like to know what is the "macro" for the system's windows drive!
I would expect something like [WindowsDrive] or [SystemDrive] or something like that so that I could set the default location to [SystemDrive]\[Appname], for instance!
Does anybody know?
I think http://msdn.microsoft.com/en-us/library/aa372057.aspx contains the info you are looking for(for .NET 3.5, other frameworks may differ).
Hopefully the following explanation/screenshots will make it easier for future readers to set the default location:
How to set the Default location to the WindowsVolume?
Use the WindowsVolume property.
Example:
Hope this helps.
[WindowsVolume][Manufacturer]\[ProductName]
Related
I made the msi package to allow the user to choose installation directory for the application.
I want the user to only download the application where it doesn't need read write permissions from the user, like %APP_DATA%/Roaming/my_app_example_name.
The reason being that the application has a self update mechanism and updates itself when it detects a new version on the server. The update itself doesn't use an msi launcher, it just downloads the new version of the app from the server using a http request, and replaces the old files.
.
.
For example, in the popular game spiral knights, they implemented this mechanism like this:
Here, you can see that the default installtation directory is the Appdata folder
If i change the installation directory to ProgramFiles, and try to install, I get this error :
It effectively blocks installation to the directory simply because it doesn't have permissions to create a folder from the installer itself, there.
I would like to implement the same mechanism, or something similar, because I think this is a very elegant solution to my problem. So any ideas on how to do this?
(By the way, I'm using jpackage to create the msi launchers)
You can use --win-per-user-install option with jpackage.
On Windows, the default is c:\Program Files\application-name; if the
--win-per-user-install option is used, the default is C:\Users\user-name\AppData\Local\application-name
More details on options at jpackage docs
I'm deploying a .NET application with VS2010. My application creates .txt file in the logs folder in the same directory with .exe:
app.exe
add.exe.config
logs (folder)
I used setup project to create a MSI installer. When I installed in the client machine C: drive or any drives I have no problem to create the .txt file, but when I installed in C:\Program File\myAppFolder or C:\Program File(x86)\myAppFolder I cannot to create the .txt file.
It is a poor design to write to install location for your application. It is better to write to the ApplicationDataFolder. The ApplicationDataFolder is under the user profile and the application will have access to write there when run as that user. #Ken White provided a very good pointer to an existing StackOverflow answer about this.
If this is a legacy application that must write to that folder, then you'll need to modify the permissions on the log folder such that all users can write to the folder. This is possible to do with the Windows Installer (aka: MSI) but I'm not sure that the Visual Studio setup projects expose it. The WiX toolset definitely supports doing such things.
An old post but I needed to do similar recently so I guess it is still valid! While I don't advocate bad design, in the real world sometimes we have to bend to requirement.
Writing to the application folder is possibly under Win7 and it is possible to set this up via an installer class in an MSI created by VS2010. You just need to give a relevant group (suggest either the "Users" group, or if you want to give more control over who gets what, supply a selection screen) Write-Data access.
Using DirectoryInfo on a path you can then get the security data from GetAccessControl.
When you have your Group known, get the SID for the group and AddAccessRule also supplying the required ControlType value.
Then set the access control on the DirectoryInfo object (SetAccessControl) using the security data object.
You can get the SID from the Groups principal object if you do a search with PrincipalSearcher.
Hope this helps
paul
This generally all depends on:
Whether your app requires to be run as administrator for other reasons and..
Whether your app is provided for limited users.
If the app requires elevation for a bunch of other reasons (and not just updating files in restricted locations) then the normal way is to have an elevation manifest embedded in your app. This isn't a good thing from the security point of view, but if you absolutely need admin privilege then this is the way to do it.
If the only operation requiring elevation is updating/creating data in the Program Files folder then don't put the file there. Every case of this that I've seen has been lazy programming where the code just refers to the file name and consequently it goes in the Program Files folder (more accurately in the same folder that the app runs in). The cure for this is to put the data file in the correct location (such as User's Application Data folder). As Rob Mensching says, you should alter the permissions on the install folder only if this is a legacy app that you cannot change.
I am making an installer where I have defined my own installer property. I want to store this property in the registry. As this property is only needed by the installer, I thought that the best location to store it would be:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT CODE}.
I use Installshield 2010 to make the installer.
What I want to know is: Is this possible and how can I do this?
Yes, this is possible. The registry values are formatted, so you can use something like this:
[MY_PROPERTY]
The location you chose is not very good. That key is used by Windows and Windows Installer internally. You can try creating your own key under SOFTWARE, for example:
HKEY_LOCAL_MACHINE\SOFTWARE\My Company\My Application
The default installation location of our applications is c:\Program Files folder. Due to virtulization, this is not a good location to install our applications in 'Program Files' folder in Windows 7. What is the preferred default installation location in Windows 7..
Does microsoft say specify anything on this?
Where can I get more information on this?
Our application can create projects which are kept in c:\Program Files\PolyCd\Projects folder. User can copy these files to other machines to use the project files. We also don't want to run the application as administrator to avoid prompting whenever the application starts. This enables virtualizations. And hence the user won't be able to see the project files he created in c:\Program Files\PolyCd\Projects folder
I have one more question. What is the preferred location of keeping the application specific data such as the project information I mentioned earlier
Ah, thanks for the clarification. Your problem is where you are storing the data. Generally, settings and the likes should be stored in the folder specified by the environment variable AppData. Project data, documents, etc however should generally be stored in the user's "Documents" folder.
'Program Files' or 'Program Files (x86)' for 32-bit software on 64-bit Windows. But you would usually use a variable like $PROGRAMFILES so Windows finds the folder itself.
Since you asked specifically "does Microsoft say anything on this?" let me show you the Windows logo requirements from Microsoft. After you download that document, you can read guidance that includes what folder to install to (Program Files) and where to keep the user's data and settings (ProgramData or AppData). If you follow these guidelines, not only will your application behave as users expect, you will find it easy to get the Windows Logo for your application, which is a shortcut into the partner program. Many of my clients save tends of thousands of dollars on software by being in the partner program, so don't dismiss the value of the logo. But the immediate value to you is clear direction about where to put your app and where to put the user's data.
I am working with Visual Studio setup projects to install web application. I am looking for a way to change the default physical file installation path. The end result I would like is a Virtual Directory called "MySite" that points to a local path on the server like "C:\Apps\MySite"
Is there a built-in option to customize this?
edit the project file. search for keyword 'virtual' and change the value for virtual directory.
No, it will install at the physical file installation path of the Web Site where it is installed plus the name of the virtual directory.
You have to do it with a custom action, unfortunately it's not supported as a simple setting in the setup project (as others have mentioned).
Here is an example implementation using custom action:
Allow user to set physical directory path during Web Project deployment
(a bit old but can still be useful)