Solved

Change a file association so that it will take effect for any user that logs onto that machine.  Windows 7 Enterprise.

Posted on 2011-09-06
6
475 Views
Last Modified: 2012-08-14
I want to be able to change the default file association for the .cs file extension on a Windows 7 Enterprise box.  Right now, Visual Studio 2010 is installed on the machine and when a user double clicks on a file with the .cs extension, Visual Studio is the one that opens,  However, I want to have it open by default with another program called MonoDevelop.  

I have tried logging on as an administrator and doing it through Control Panel | Default Programs, but that does not seem to affect all subsequent users that log on.  The machine is locked down so that a regular user could not make this change when they log on, in addition, profiles on the machine are wiped out every night so even if the user did change it for themselves, they would have to do over and over again.  

I would like to be able to change it via a registry edit for the default user (but don't know how) or I've read it can be done in the HKLM | Software | Classes and it will affect all users.  

I can see the .cs file association key in the HKLM | Software | Classes and the registry keys look like this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs] "Content Type"="text/plain" "PerceivedType"="text" @="VisualStudio.cs.9.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\OpenWithProgids] "VisualStudio.cs.9.0"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\OpenWithProgids\Shared] @="Shared key to keep this from being removed with install/uninstall of side-by-side components." [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\PersistentHandler] @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

If anyone can help me I would greatly appreciate it.  

0
Comment
Question by:cscuvic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

Accepted Solution

by:
johnb6767 earned 83 total points
ID: 36490236
You should try it here....

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VisualStudio.cs.9.0

Under there, you will see a "Shell>Open>Command", and try changing the path there.....
0
 

Author Comment

by:cscuvic
ID: 36490374
Wow, that was fast :)

I just tried changing the path to point to the MonoDevelop.exe:
C:\Program Files\MonoDevelop\bin\MonoDevelop.exe (I did not put it in quotes)

Then tested it as a regular user.  When I double clicked on the .cs file, MonoDevelop opened instead of Visual Studio (which is great), but there is also an error that says:  There was a problem sending the command to the program.  

Are there other entries within that registry key that I need to amend?

Thank you again,
0
 
LVL 3

Assisted Solution

by:OliverLo
OliverLo earned 167 total points
ID: 36490505
Hi Csuvic,

If you want to perform the change on more that one computer and can configure Group Policies then you could try to use Windows 7 preferences:
1
Click the Windows server "Start" button and then click "Administrative Tools." Click "Group Policy Management Console" to open the policy manager.
2
Right-click the group policy server name and select "Edit." In the list of options, click "Computer Configuration," "Preferences," then "Control Panel Settings."
3
Right-click the "Folder Options" icon and select "New," then "File Type." This opens a new configuration window.
4
Select "Replace" from the "Actions" drop-down box. Select "File Extension" from the "File Type Settings" drop-down box.
5
Enter the file extension for the new group policy. Select Monodevelop.exe from the list of software in the "Association" list. Click "OK" to save your settings and close the group policy editor.
6
Force the policy update on one of the target computer:
gpupdate /force /target computer

You should then see that monodevelop replaced Visual Studio to open this specific extension.


0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 

Assisted Solution

by:cscuvic
cscuvic earned 0 total points
ID: 36491795
Hi, I've tried the gpo solution, but I have variances from the instructions you posted.  
In step 2, I right-click the GPO that I want to add the file association change to
In step 3, I make the choices as described
But in Step 4, "Select "File Extension" from the "file Type Settings" drop down box is not there.  What I have for choices in the "New File Type Properties" dialog box that pops up is: Action (which I chose Replace), File extension: (which I typed in cs), and then there is an Associated class: (with a drop down box that does not contain the choice of File Extension, or my MonoDevelop program).  

0
 
LVL 3

Assisted Solution

by:OliverLo
OliverLo earned 167 total points
ID: 36492407
On my own server it is working if:
- I set Associated Class to ".NET managed resources file"
- I tick the checkbox "Configure class settings"
- I click on New in the Action section
- In the New Action windows
   > I write Replace in Action field
   > I write the path to monodevelop in "Application used to perform action"
- I save all these settings
- I update the GPO for the computer

I checked and it's working for different users...
0
 

Author Closing Comment

by:cscuvic
ID: 36521440
Both solutions tackled the problem from different angles and both did what they said they would.  I ended up going with the registry path change (solution 1) but will look at implementing the gpo solution at a later date.  Thanks to both johnb6767 and oliverlo for their quick responses.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question