In order to enter console commands in XCOM 2, you first need to enable the console. The way the console is enabled is different depending on whether you are launching XCOM 2 through Steam or not.
If you are playing XCOM 2 on Steam, follow these instructions to enable the console:
Open Steam
Go to your "Library"
Right-click XCOM 2
Click and open "Properties"
Click "Set Launch Options..."
Enter -allowconsole and press OK. If this does not work, try entering -allowconsole -log -autodebug.
The console is now enabled, and you can enter console commands. See How to Use the XCOM 2 Console for help entering commands.
On non-Steam versions of XCOM 2, follow these instructions on how to enable the console:
The console is now enabled, and you can enter console commands. See How to Use the XCOM 2 Console for help entering commands.