Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5941937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:10:50+00:00 2026-05-22T16:10:50+00:00

When I use Application.UserAppDataPath to get to configs, I’ve got a ArgumentException Illegal characters

  • 0

When I use Application.UserAppDataPath to get to configs, I’ve got a ArgumentException “Illegal characters in path.”
According to Microsoft it is not a bug, but a feature;

The only way how you can get an illegal character in FileVersionInfo.ProductVersion (and hence in Application.ProductVersion and Application.UserAppDataPath) is when you also have AssemblyFileVersion on the assembly. The value that goes to AssemblyFileVersion is copied to the Win32 resources verbatim and overrides the value you pass to AssemblyVersion. This behavior is by design.

So by commenting [assembly: AssemblyFileVersion(“…”)] in AssemblyInfo.cs one could solve this exception.

The problem is:
I’m writing some .dll with winforms controls. Easiest design to get this path would be to use Application.UserAppDataPath. But if Application.UserAppDataPath is used, then developers who use this library cannot have AssemblyFileVersion for their .exe files. (While AssemblyFileVersion is in the AssemblyInfo.cs by default)

Also I couldn’t find any information by Microsoft that using AssemblyFileVersion should brake my application and somebody shouldn’t use it. So I, actually, can’t ask it from this library users.

Is there a reason or logic in such weird situation?
What is a better work-around to get Application.UserAppDataPath path with no such problems?

While I have AssemblyFileVersion and Application.UserAppDataPath would throws the exception, the application works and i could get this path through

string path = ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;

The config files are there and have no problems. But, certainly, it is an ugly way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:10:51+00:00Added an answer on May 22, 2026 at 4:10 pm

    If I read that post on Connect correctly you have to use AssemblyFileVersion with an illegal char (‘*’).

    Appropriately it ends with “If you still believe that this is a bug” ….

    Did you reproduce the error, and was that a realistic scenario?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Winforms and Console Applications can use Application.UserAppDataPath . What if I want to build
In Winforms I would use Application.ProductVersion to get the version of my code. Is
I am not sure how to use Application Setting with custom user types. For
The agreement says this: 3.3.2 An Internal Use Application may not download or install
I use Application Host COM Protoco to get publishing point under one website, when
Is there another way to load MSHTML documents without use Application.ProcessMessages? To load a
Can the application use set same char in the XON and XOFF? If yes,
we use an application that has an export to excel feature that doesn't work
I am trying to use FIX::Application along with SessionSettings. The Fix server I am
Lots of times when I use an application that needs perforce access (Visual Studio,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.