4

One of the projects I work on need to read a registry key in order to determine some value. Usually the value will be written during installation.

Because I want to run the project locally as well (without installation) I want to write that value after the build has finished.

Is there a simple way I can do that?

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Dror Helper
  • 30,292
  • 15
  • 80
  • 129

2 Answers2

6

Searching the web I've found this cool tool that comes with windows called REG.EXE

Using it from within VS is simple - REG ADD HKLM\SOFTWARE\\ /v NUnitDir /t REG_SZ /d /f

Community
  • 1
  • 1
Dror Helper
  • 30,292
  • 15
  • 80
  • 129
2

You can create a small program that creates your registry key and call that program in the post build event.

Edit
If you can extract your registry settings to a file, you can add this to you post build event:
regedit /s $(ProjectDir)test.reg

/s makes it silent.

Jens Granlund
  • 4,950
  • 1
  • 31
  • 31