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
477 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

623 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