SQLCMD is not working in pre-deployment script in sql project I have sql project in visual studio and I created pre-deployment script

/*
 Pre-Deployment Script Template                         
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be executed before the build script.   
 Use SQLCMD syntax to include a file in the pre-deployment script.          
 Example:      :r .\myfile.sql                              
 Use SQLCMD syntax to reference a variable in the pre-deployment script.        
 Example:      :setvar TableName MyTable                            
               SELECT * FROM [$(TableName)]                 
--------------------------------------------------------------------------------------
*/

:setvar TableName MyTable                           
SELECT * FROM [$(TableName)]    


but Iam getting an error at :setvar line

Incorrect syntax near ':'.


what am I missing ?
Community wiki answer:

You need to switch to SQLCMD mode in Visual Studio via the menu SQL > Execution Settings.

You can also have all SQL files open in SQLCMD mode by default if you dig into Options > SQL Server Tools > Query Execution.