1

Is there a way to add all the .NET object names to my dictionary in MS-Word? I use them a lot when writing daily progress notes or documentation and it would be nice if auto-correct didn't chide me every time, but actually helped me identify the correct word I am looking for. I know how to add a single word manually, but that is not an option. Is there a quick/built-in way to add all these names, or do I need to edit a file programatically?

Joel B
  • 1,215

1 Answers1

1

This should work from PowerShell:

$net4 = gci "C:\Windows\Microsoft.NET\Framework\v4.0.30319" | Where-Object {$_.Extension -eq ".dll"}

$net4 | ForEach-Object {
$_.name | Out-File "C:\Users\YourUser\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC" -Append
}

You could either have it loop through all frameworks to be safe, or do it once for each .NET directory.

Also, if you want the filename without the extension (.dll) use $_.Basename


Update: Ran the script and it did work for me. I added the libraries this way, mscorlib for example.


I am also able to get methods:

$net4 = gci "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\" -Recurse -Force | Where-Object {$_.Extension -eq ".dll"}

$Methods

$net4 | ForEach-Object {

$Methods += $_ | Get-Member -Force -View All | Select -ExpandProperty Name

}

$Methods | Out-File "C:\Users\UserName\AppData\Roaming\Microsoft\UProof\CUSTOM.DIC" -Append

And it gets me (among lots, lots more):

OpenWrite
Refresh
Replace
SetAccessControl
set_Attributes
set_CreationTime
set_CreationTimeUtc
set_IsReadOnly
set_LastAccessTime
set_LastAccessTimeUtc
set_LastWriteTime
set_LastWriteTimeUtc
ToString
PSChildName
PSDrive
PSIsContainer
PSParentPath
PSPath
PSProvider
Attributes

Now the problem is there are many duplicates, but from here it should be simpler.

You could also use the C:\Windows\Microsoft.NET\Framework directories instead of the GAC if you wish.