Click here to Skip to main content
15,886,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am unable to get a file to copy during installation. Here's the background.

This is a Winforms project, C# in VS2017. It connects to a local MSAccess database. I need to install this .accdb where any user running the application can read and write to it. In my Solution, I'm working with a Windows Deployment Project.

My searches indicated that the CommonAppDataFolder is the place for this. That particular folder however is not offered by in the VS IDE, but I can create it, and my installed exe's recognize it.

The installation creates the folder, but it fails to copy the file into it during installation.

How can I get this file to copy during install and so that all users of my application can read/write to it?

Thanks for helping.

What I have tried:

In my deployment project, in File System Editor, I have done:
Add Special Folder, Custom Folder, and set its properties as:
Name: CommonAppDataFolder
AlwaysCreate: True
Condition:
DefaultLocation: [CommonAppDataFolder]
Property: COMMONAPPDATAFOLDER

Then on that folder, I've done:
Add, File... and navigated to and selected my .accdb.
The file properties are (I have made no changes):
Condition:
Exclude: False
Folder: CommonAppDataFolder
Hidden: False
PackageAs: vsdpaDefault
Permanent: False
ReadOnly: False
Register: vsdrfDoNotRegister
SharedLegacyFile: False
SourcePath: C:\Users\Armstrong1\Documents\Visual Studio 2017\Projects\ArmstrongAnalytics\ArmstrongAnalytics\App_Data\DHHScreen.accdb
System: False
TargetName: DHHScreen.accdb
Transitive: False
Posted
Updated 8-Aug-19 22:28pm

1 solution

Keep a "master" in the installation folder and copy; or generate it in the app folder on first time use.
 
Share this answer
 
Comments
Member 3906768 9-Aug-19 12:23pm    
Thanks Gerry. I had that same idea and in fact I did exactly that. It just seems like a hack. Still, I can't understand why I can't install directly into the CommonAppDataFolder.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900