Unable to resolve SQL variable

Anyone have any tips on how to get rid of this error message? Do I need a certain plugin or something else?


Code in text format:
public async Task<IEnumerable<TModelDao>> GetModelsAsync<TModelDao>(string tableName, int page, int size)
    var offset = (page - 1) * size;
    var sql = $"SELECT * FROM {Schema}.[{tableName}] ORDER BY [id] OFFSET @Offset ROWS FETCH NEXT @Size ROWS ONLY";

    await using var connection = connectionFactory.CreateSqlConnection();

    var models = await connection.QueryAsync<TModelDao>(sql, new { Offset = offset, Size = size });

    return models;


Hello Jone Jeremiassen ,

Thank you for reaching Rider Forum.

I could not reproduce the issue you are facing:\

Could you please try tweaking the MSBuild version in Settings | Build, Execution, Deployment | Toolset and Build

Let me know if that helps. 


Thank you for the quick reply Anna Morozyuk!

Here is an image of my MSBuild settings:

Please let me know if I should change anything, thanks!


I tried updating it to use the auto detected MSBuild version, but I am still not able to get rid of the red error message:

It compiles and runs just fine, I just want to get rid of what seems like an error message. Unable to choose schema ^ (Nothing to show).

Unable to resolve variable '@Offset'

Unable to resolve variable '@Size'


I did some more digging. I am only to build the solution with the MSBuild version set to the Visual Studio one. When I put on the auto detect (C:\Program Files\dotnet\sdk\8.0.204), the build fails:

  The imported project "C:\Program Files\dotnet\sdk\8.0.204\Microsoft\VisualStudio\v17.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\8.0.204\Microsoft\VisualStudio\v17.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" is correct, and that the file exists on disk.  C:\Users\jone.jeremiassen\.nuget\packages\microsoft.build.sql\0.1.3-preview\Sdk\Sdk.targets


My Database.sqlproj:


Have you checked your database connection in Rider? 

With setting right database schema and correct SQL dialect in Rider, it should not been mark as error.

The error should just been marked in Rider but will not prevent to build the solution, so it should not related to your build toolchain.


Please sign in to leave a comment.