How to restrict .Net build to run on specific machines
There are several ways to control access to assemblies.
We protect our builds on a license basis, so only licensed workstations can run the build.
We allow developers to run debug builds without checking. Of course, we keep tight control over the debug builds. you can put additional checks in the debug build for more security if needed. Or issue licenses to developers.
For our debug builds, we add the license to the debug code wrapped in "#IF DEBUG" to make sure it is not compiled into a release build.
I am not saying this is the best way, but this is the method we are using.
a source to share
I'm assuming you are looking for a simple fail-safe, not airborne access control ...
Place the machine name in the config file and compare it with the machine name when starting the application. This way you can't run it elsewhere by mistake, and it's easy enough to change when developing or moving the app.
a source to share