A useful regfile for VSTO

A useful regfile for VSTO

  • Comments 8

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_ROOT\dllfile\shell\FullTrust]

@="Trust assembly"

 

[HKEY_CLASSES_ROOT\dllfile\shell\FullTrust\command]

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

 

 

[HKEY_CLASSES_ROOT\dllfile\shell\UnTrust]

@="Remove assembly trust"

 

[HKEY_CLASSES_ROOT\dllfile\shell\UnTrust\command]

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

 

 

[HKEY_CLASSES_ROOT\exefile\shell\FullTrust]

@="Trust assembly"

 

[HKEY_CLASSES_ROOT\exefile\shell\FullTrust\command]

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

 

 

[HKEY_CLASSES_ROOT\exefile\shell\UnTrust]

@="Remove assembly trust"

 

[HKEY_CLASSES_ROOT\exefile\shell\UnTrust\command]

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

 

 

[HKEY_CLASSES_ROOT\Folder\shell\FullTrust]

@="Trust folder"

 

[HKEY_CLASSES_ROOT\Folder\shell\FullTrust\command]

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

 

 

[HKEY_CLASSES_ROOT\Folder\shell\UnTrust]

@="Remove folder trust"

 

[HKEY_CLASSES_ROOT\Folder\shell\UnTrust\command]

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