Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Setup / February 2006

Tip: Looking for answers? Try searching our database.

How to find a directory exists or not

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sajithpt - 13 Feb 2006 05:36 GMT
Hi,
From the setup program, how to check for whether a particular directory
exists in the target machine.
Say, I want to search whether the following directory exists or not:
Program Files\Common Files\Microsoft Shared\VS Help Data\8.0\Filters\1033

I know how to do a file search, but could not find any pointers on how to
find a folder exists or not.

Thanks,
Sajith
Phil Wilson - 15 Feb 2006 02:51 GMT
You're stuck unfortunately.
There is no search for a folder in Visual Studio setup projects. With other
setup tools you could do a custom action that runs early in the setup, but
there's no support in VS for that. What do you want to do with the folder?
Signature

Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

> Hi,
> From the setup program, how to check for whether a particular directory
[quoted text clipped - 7 lines]
> Thanks,
> Sajith
sajithpt - 15 Feb 2006 10:00 GMT
Hi Phil,

Thanks for your reply.
Let me explain the situation-
I want to copy a file to a visual studio directoy in the target m/c
depending on which language version of VS.Net is installed.

It is a search filter file and I want to copy it to
Program Files\Common Files\Microsoft Shared\VS Help Data\8.0\Filters\1033
(for English if this directory exists in target m/c)
and to
Program Files\Common Files\Microsoft Shared\VS Help
Data\8.0\Filters\1041(for Japanese version, if this directory exists)

I have two copies of the file to be copied(for Eng and Japanese).

How to do this in the setup program?

Thanks a lot for your help.

Sajith

> You're stuck unfortunately.
> There is no search for a folder in Visual Studio setup projects. With other
[quoted text clipped - 11 lines]
> > Thanks,
> > Sajith
Phil Wilson - 15 Feb 2006 20:40 GMT
You're stretching what can be done with a Visual Studio setup project. I
wouldn't bother to search for the folder, I'd just install the file at:

[CommonFilesFolder]Microsoft Shared\VS Help
Data\8.0\Filters\[UserLanguageID]

Those property names are case-sensitive. [CommonFilesFolder] gets you to the
common files folder, and UserLanguageID will be 1033 or 1041 depending on
the users language spec on the system.   Install the english file if
UserLanguageID=1033, otherwise the Japanese one.
Signature

Phil Wilson [MVP Windows Installer]
----

> Hi Phil,
>
[quoted text clipped - 38 lines]
>> > Thanks,
>> > Sajith
sajithpt - 16 Feb 2006 07:36 GMT
Hi Phil,

In this case, it will create the directoy if it doesn't exist.
How in the setup program to specify that copy the file only if the folder
exists?.

Also I have to create a registry key in hive-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Help\VisibleFilters
(if this hive already exists). How to do this, because this should not
create the hive if it doesn't exist.

Also, how to know which version of VS is installed?(2003/2005).

Thanks for your help.
Sajith

> You're stretching what can be done with a Visual Studio setup project. I
> wouldn't bother to search for the folder, I'd just install the file at:
[quoted text clipped - 48 lines]
> >> > Thanks,
> >> > Sajith
Phil Wilson - 20 Feb 2006 20:46 GMT
Yes it will create the directory, but is that such a bad thing? The issue is
that you can't do what you want to do with a Visual Studio setup project
because there's no IDE support for adding code to look for folders or
registry keys before the install. The least pain alternative is just to
install it as I described and create the directory. There are about 20 other
tools that can generate MSI setups, and Visual Studio just doesn't let you
do the things that tools from InstallShield, Wise etc can do.

I can't think of a good way to detect VS 2003 or 2005 for you. There might
be registry entries. I'd normally use the MSI APIs to see if their product
Guids are installed, such as:

{437AB8E0-FB69-4222-B280-A64F3DE22591} Microsoft Visual Studio 2005
Professional Edition - ENU
{E05F0409-0E9A-48A1-AC04-E35E3033604A} Visual Studio .NET Enterprise
Architect 2003 - English

and then launch the MSI file with a command line indicating which are there
(both of them could be there).
Signature

Phil Wilson
[Microsoft MVP-Windows Installer]

> Hi Phil,
>
[quoted text clipped - 68 lines]
>> >> > Thanks,
>> >> > Sajith
sajithpt - 23 Feb 2006 06:24 GMT
Hi Phil,

Thanks a lot for your help.

Sajith

> Yes it will create the directory, but is that such a bad thing? The issue is
> that you can't do what you want to do with a Visual Studio setup project
[quoted text clipped - 87 lines]
> >> >> > Thanks,
> >> >> > Sajith

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.