8

I want to install my database to a separate folder (@ C:\Users\User1\AppData\Roaming\Company1\database.mdb)

I'm using a C# setup project.

How can I do it?

4

3 に答える 3

7
  1. プロジェクトを右クリックして、[表示]->[ファイルシステム]を選択します
  2. 新しい[ファイルシステム]画面で、ルートノード(ターゲットマシンのファイルシステム)を右クリックし、[特別なフォルダーの追加]->[ユーザーのアプリケーションデータフォルダー]を選択します。
  3. ツリービューから新しく追加されたフォルダーを選択し、必要なサブフォルダー構造を作成します
  4. 最後に、宛先フォルダーを選択し、右クリックして[追加]-> [ファイル]を選択し、.mddbファイルを選択します。
于 2011-12-02T10:14:29.450 に答える
5

Right click on your Setup project -> View -> File System. Then you could add a custom folder and set its default location to [CommonAppDataFolder]:

enter image description here

Then add your database file to this folder.

于 2011-12-02T10:12:46.997 に答える
3

Just for completeness, here is the official documentation for changing the folders: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/716bxh4e(v=vs.100)

  1. To add a custom folder that targets a predefined Windows folder In the folder list of the File System Editor, select the File System on Target Machine node.
  2. On the Action menu, point to Add Special Folder, and then click Custom Folder. The new folder is highlighted in the folder list.
  3. Type a name for the custom folder. For example, to target the Temp folder, type "Temp Folder".
  4. In the Properties window, select the DefaultLocation property and enter the Windows Installer system folder property for the folder you wish to target. For example, the property for the Temp folder is [TempFolder]. For a list of system folder properties supported by Windows Installer, see System Folder Properties.

Here is a list of all folder properties: https://docs.microsoft.com/en-us/previous-versions//aa372057(v=vs.85)?redirectedfrom=MSDN

Property Description
AdminToolsFolder The full path to the directory that contains administrative tools.
AppDataFolder The full path to the Roaming folder for the current user.
CommonAppDataFolder The full path to application data for all users.
CommonFiles64Folder The full path to the predefined 64-bit Common Files folder.
CommonFilesFolder The full path to the Common Files folder for the current user.
DesktopFolder The full path to the Desktop folder.
FavoritesFolder The full path to the Favorites folder for the current user.
FontsFolder The full path to the Fonts folder.
LocalAppDataFolder The full path to the folder that contains local (nonroaming) applications.
MyPicturesFolder The full path to the Pictures folder.
PersonalFolder The full path to the Documents folder for the current user.
ProgramFiles64Folder The full path to the predefined 64-bit Program Files folder.
ProgramFilesFolder The full path to the predefined 32-bit Program Files folder.
ProgramMenuFolder The full path to the Program Menu folder.
SendToFolder The full path to the SendTo folder for the current user.
StartMenuFolder The full path to the Start menu folder.
StartupFolder The full path to the Startup folder.
System16Folder The full path to folder for 16-bit system DLLs.
System64Folder The full path to the predefined System64 folder.
SystemFolder The full path to the System folder for the current user.
TempFolder The full path to the Temp folder.
TemplateFolder The full path to the Template folder for the current user.
WindowsFolder The full path to the Windows folder.
WindowsVolume The volume of the Windows folder.

When using them, make sure to use the square brackets [] around the property names.

于 2020-10-13T09:13:11.450 に答える