You've already forked setup-msbuild
mirror of
https://github.com/microsoft/setup-msbuild.git
synced 2026-09-25 11:17:01 +07:00
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:
Vendored
+7
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user