Joined: 14 Mar 2007
Location: Ålesund, Norway
|Posted: Mon 2 Apr 12:55:36 2007 Post subject: "Invalid License" error when running application
|If your license is otherwise ok, this is normally caused by the Target project not being built after the CDP_Application project.
In CDP 22.214.171.124, the validation of the executable is done by the Pre-Build Event of the Target project. If the Target project is not built after the CDP_Application project has generated a new .exe file, the .exe file will generate an "Invalid License" error during startup.
The problem often occurs when starting the application, and Visual Studio detects that something has changed (even if it has not). It then asks if it should rebuild the executable, but when it does, it does not build the Target project afterwards, rendering the executable unvalidated.
To fix this, either make sure that the Target project is built by always using "Build solution" when building your solution.
Or, move the Pre-build event from the target project to be a Post-build event under the CDP_Application project. The Post-Build event of the CDP_Application project should then become:
Command line: "$(CDPBase)\Tools\ValidateLicense.exe" "$(TargetPath)"
Description: Validating executable $(TargetPath).
Remember to delete the Pre-Build event for the Target project, and to do this modification for all configurations (not just the Debug or Release configuration).
Svein Erling Linge, ICD