MistyK
MistyK

Reputation: 6222

Asp.net Core 1.0 project.json prepublish scripts

Hey this is a part of my project.json file:

  "scripts": {
        "prepublish": [
          "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
          "node node_modules/webpack/bin/webpack.js"
        ],
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
      },

I want to invoke prepublish scripts every time I publish the application even if it's a development environment and I am running it through visual studio or dotnet run. Prepublish doesn't seem to work in these cases

Upvotes: 4

Views: 1890

Answers (1)

Set
Set

Reputation: 49769

When you run through VS or using 'dotnet run', you only build and run the application from source, without publishing. Publishing scripts will be triggered, if you call dotnet publish.

The dotnet run command provides a convenient option to run your application from the source code with one command. It compiles source code, generates an output program and then runs that program.

Right now only the following types of script are supported:

  • precompile
  • postcompile
  • prepublish
  • postpublish

and what you want is more like "beforerun"/"postrun". As a workaround you may try to call your scripts directly from code in your application entry point.

Upvotes: 1

Related Questions