microsoft / microsoft/DacFx

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

Open
#615 1 comment 0 reactions 0 assignees View on GitHub
area: build sdk enhancement
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

**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.

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by locating SQLCMD script-reference parsing and the existing build diagnostic and suppression mechanisms. Done means backslash-separated references produce a non-breaking, suppressible SQLCMD001 warning with the reference shown, while forward-slash references remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
build-system, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.