Skip to content

Warn if Windows-style path separators (\) are used in script references #615

Open
@jasonhorner

Description

@jasonhorner

Is your feature request related to a problem? Please describe.
I'm often frustrated when SQL project builds work on Windows but fail on Linux-based agents (e.g., ubuntu-latest in Azure DevOps) because SQLCMD-style script references use Windows path separators (e.g., :r .\Pre-Deployment\Init.sql). This causes cross-platform builds to break without a clear error message pointing to the source of the problem.


Describe the solution you'd like
I'd like DacFx to emit a warning (e.g., SQLCMD001) during build if a script reference includes Windows-style backslashes (\) in its path. This would help developers proactively identify cross-platform compatibility issues before they hit CI/CD.

Example warning:

Warning SQLCMD001: Script reference uses Windows-style path separator: :r .\Pre-Deployment\Init.sql. Consider using forward slashes (/) for cross-platform compatibility.

The warning could be:

  • Non-breaking (does not fail the build)
  • Suppressible

Describe alternatives you've considered

  • Writing pre-build PowerShell or Bash scripts to scan for :r .\ and manually fail the build
  • Using linting tools (but none currently cover SQLCMD path conventions well)

None of these provide the integrated, first-class experience that a native DacFx warning would.


Additional context
This issue becomes especially painful when moving SQL build pipelines to Linux agents or Docker-based environments where path compatibility is stricter. Emitting a simple warning could save hours of troubleshooting in larger teams.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions