0

I am preparing a custom action that copies a file to a specific location. Existing users of the application will already have the file in the SpecialDirectories.AllUsersApplicationData location. So I want to check there first.

However, at install time, when I try and access this location, this resolves to

...\Microsoft Corporation\Windows Installer - Unicode\3.1.4001.5512

Is there a quick way to get to the AllUsersApplicationData location for the app I'm installing, instead of the installer?

1 Answer 1

2

You cannot use AllUsersApplicationData in this scenario, neither in the installer nor in your application. The installer cannot guess the version number correctly. Just make your own so that the installer can compute the path and get the right directory.

Use Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) and append your company and product name. And you probably want to append a version number. This version should be the version of the application data, not the application. Just make up your own, start at "1.0". The installer now has no trouble doing the same.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.