Syncfusion license register without hardcoded
Syncfusion is introduced the licensing system from v16.2.0.41 for Syncfusion NuGet packages and evaluation setup. You should generate and register the license key when launching your application.
The following steps help you to register the license key in environment variable and without hardcode in your application:
1. To register the license key in environment, please navigate to Control Panel > All Control Panel Items > System and choose Advanced system settings.
2. Choose Environmental variables... from the pop-up.
3. Select New and set the variable in user variables pop-up. Use the variable name as SyncfusionLicenseKey and value as your license key.
4. Click Ok to complete your license key registration as environmental variable.
5. Download the batch file and extract the zip file.
6. Place the SyncfusionLicenseRegister.bat file in project file location.
7. Open your Visual studio application to apply the license.
8. Use the following code to register the Syncfusion license key from environmental variable:
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("##SyncfusionLicense##");
You can refer to the following link, recommended files for each platform to register the Syncfusion license:
https://help.syncfusion.com/common/essential-studio/licensing/registering-license-keys
8. Open the project properties and set the prebuild and postbuild event to replace the license key in compilation time.
PreBuild: cd "$(ProjectDir)"
SyncfusionLicenseRegister.bat PreBuild {filepath of Syncfusion License registered code}
PostBuild: cd "$(ProjectDir)"
SyncfusionLicenseRegister.bat PostBuild {filepath of Syncfusion License registered code}
Example for WPF application
PreBuild: cd "$(ProjectDir)"
SyncfusionLicenseRegister.bat PreBuild App.xaml.cs
PostBuild: cd "$(ProjectDir)"
SyncfusionLicenseRegister.bat PostBuild App.xaml.cs
9. The compiled application will run based on the registered license key.