Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jasonhorner opened this issue Apr 22, 2025 · 1 comment

Comments

@jasonhorner
Copy link

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.

@ErikEJ
Copy link
Contributor

ErikEJ commented Apr 22, 2025

I will add this proposal to our MsBuild.Sdk:SqlProj project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants