Register a problem matcher for MSBuild/csc errors and warnings

- Add .github/msbuild.json with two owners: one matching file-based
  diagnostics (File(line,col): error/warning CODE: msg [project]) and
  one matching engine-level errors without file/line info.
- Register the matcher in src/main.ts via the ##[add-matcher] workflow
  command, resolved relative to __dirname so it works from the ncc
  bundle in dist/.
- Add src/__tests__/msbuild-matcher.test.ts validating the matcher
  regexes against representative CS/MSB error and warning lines.
- Document the new problem matcher in README.md.
- Rebuild dist/index.js via npm run build && npm run pack.

Fixes #4

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Chet Husk
2026-09-21 16:20:37 -05:00
parent e93fc1308b
commit a5f6b5adfd
5 changed files with 151 additions and 0 deletions
+7
View File
@@ -42,9 +42,16 @@ if (VS_VERSION !== 'latest') {
VSWHERE_EXEC += `-version "${VS_VERSION}" `;
}
core.debug(`Execution arguments: ${VSWHERE_EXEC}`);
function registerProblemMatcher() {
const matcherPath = path.join(__dirname, '..', '.github', 'msbuild.json');
core.info(`##[add-matcher]${matcherPath}`);
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
// register the problem matcher so MSBuild/csc errors and warnings are
// annotated in the workflow log and any related pull request
registerProblemMatcher();
// exit if non Windows runner
if (IS_WINDOWS === false) {
core.setFailed('setup-msbuild can only be run on Windows runners');