A useful regfile for VSTO

Here's a quick post with a regfile you can use to help you test your VSTO projects.

Cut and paste the text below into a text file (be careful of line wrapping) and save it with a reg extension. Then open up regedit (as a member of the Administrators group) and select File -> Import... from the menu and navigate to the file you just saved (you could also just double-click on the reg file in Windows Explorer).

This will give you two new context menu items on DLLs, EXEs, and Folders. The first one will add a URL membership condition to user-level policy to fully-trust the file (or folder), and the second one will remove that entry from policy. Note that these shortcuts are pretty dumb, they won't actually "untrust" the file or folder (they just remove the "explicit" entry required by VSTO), they could completely destroy your computer and the surrounding countryside, they should be used at your own risk, etc. etc. etc.

 

Windows Registry Editor Version 5.00

 

[HKEY_CLASSES_ROOTdllfileshellFullTrust]

@="Trust assembly"

 

[HKEY_CLASSES_ROOTdllfileshellFullTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -ag 1 -url "%1" FullTrust -n "%1""

 

 

[HKEY_CLASSES_ROOTdllfileshellUnTrust]

@="Remove assembly trust"

 

[HKEY_CLASSES_ROOTdllfileshellUnTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -rg "%1""

 

 

[HKEY_CLASSES_ROOTexefileshellFullTrust]

@="Trust assembly"

 

[HKEY_CLASSES_ROOTexefileshellFullTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -ag 1 -url "%1" FullTrust -n "%1""

 

 

[HKEY_CLASSES_ROOTexefileshellUnTrust]

@="Remove assembly trust"

 

[HKEY_CLASSES_ROOTexefileshellUnTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -rg "%1""

 

 

[HKEY_CLASSES_ROOTFoldershellFullTrust]

@="Trust folder"

 

[HKEY_CLASSES_ROOTFoldershellFullTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -ag 1 -url "%1"\* FullTrust -n "%1""

 

 

[HKEY_CLASSES_ROOTFoldershellUnTrust]

@="Remove folder trust"

 

[HKEY_CLASSES_ROOTFoldershellUnTrustcommand]

@="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\caspol.exe -q -u -rg "%1""