BlazingFrog
BlazingFrog

Reputation: 2455

How to also build when deploying locally with visual studio 2015

I have that web site I'm building using .Net Core and I'm trying to change the deploy procedure to make sure it always builds prior to deploying.
It seems the Visual Studio default is to not build because the command I see in the build output goes like this (note the --no-build at the end:

C:\Program Files\dotnet\dotnet.exe publish "D:\Workspaces\ERMA-Dev\ERMA\ERMA.Web" --framework netcoreapp1.0 --output "C:\Users\myuser\AppData\Local\Temp\PublishTemp\ERMA.Web51" --configuration Release --no-build

I've looked in every publishing-related config file I could find (json, XML, PS script, etc) but did not find where to remove that switch. Any idea?

Upvotes: 1

Views: 26

Answers (1)

Frank
Frank

Reputation: 713

In your project.json file, add a "scripts" section or add a new line to your scripts for prepublish. Like this "prepublish": [ "dotnet build"]

For example your "scripts" section could look like this:

"scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ],
    "prepublish": [ "dotnet build"]
}

Upvotes: 1

Related Questions