Running custom scripts during build/compile in node js visual studio

Ajith Kumar V 21 Reputation points
2022-02-21T18:27:48.443+00:00

I have created a sample app https://github.com/ajithvallabai/TestMethod in Visual studio 2019 . I want to run prebuild and build scripts in package.json https://github.com/ajithvallabai/TestMethod/blob/master/TestMethod/package.json#L10-L11 when we build the solution . Is there any way to do it ?

(In this app there is no build-events option in Project>properties

This method is only working for "buid" command https://learn.microsoft.com/en-us/visualstudio/javascript/compile-typescript-code-npm?view=vs-2022 that too it needs additonal files like .ts files .tcx files . but i want to run custom commands.

You can give answer for VS19/VS22 also

Community Center Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-02-21T22:14:05.463+00:00

    its is still a MSBuild project file. just add execute command to the targets you want:

    https://learn.microsoft.com/en-us/visualstudio/msbuild/exec-task?view=vs-2022

    and target after build

    https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2022

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.