Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Just as described in the Application.CommonAppDataPath Property documentation, the path created on my system includes the CompanyName, ProductName, and ProductVersion.

 

The ProductVersion is read from the AssemblyInfo file and is currently set to 3.0.508.1 and the sub-folder is created to correspond to that. However, I really want the CommonAppDataPath to reflect only the first two numbers of the ProductVersion (e.g. 3.0) or perhaps to omit the ProductVersion altogether. Unfortunately, I know of no way to do that.

 

Does anyone have any experience with this or any suggestions?

"Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
  • Leaders
Posted

How about constructing the path name yourself.

Private Function AppDataPath() As String
       'Keep only the first two numbers in the version
       Dim Version As String = Application.ProductVersion & "."
       Dim VersionLength As Integer = Version.IndexOf("."c) + 1
       VersionLength += Version.Substring(Version.IndexOf("."c) + 1).IndexOf("."c)
       Version = Version.Substring(0, VersionLength)

       'Create the application data folder using the formula specified in
       'MSDN (CommonAppData\Company Name\Product Name\Version)
       Dim MyPath As String = Environment.GetFolderPath _
           (Environment.SpecialFolder.CommonApplicationData)
       MyPath = IO.Path.Combine(MyPath, Application.CompanyName)
       MyPath = IO.Path.Combine(MyPath, Application.ProductName)
       MyPath = IO.Path.Combine(MyPath, Version)
       Return MyPath
End Function

[sIGPIC]e[/sIGPIC]
Posted

It is quite simple,

open your Deployment project, there is a property named "Folder". THis property is shown only when u click on the primary output file.

 

So, if you want to store it in other path. You do this.

 

1. double click on Primary output,

2. You will see a "File System on target machine" on the left

3. right click on the empty space and choose "Add Special Folder".

4. And add ur path over here.

 

Hope this is what u are looking for.

George C.K. Low

  • Leaders
Posted
I'm sorry, are you looking to change the path that the deployment project outputs to or are you looking to get a folder name as a string within your program?
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...