3

I have a created an empty ASP.NET Core 2.2 project in Visual Studio and I manage to build it.

Now I need to build that ASP.NET project in a build server like Jenkins, which has a MSBuild plug in.

I have tried to search in Stackoverflow for a solution, but the only closest post I could get is this: Build a solution with an ASP.NET Core project on a build server

Is it possible to build ASP.NET Core project with powershell and publish wwwroot to a specific location?

If yes, could you provide an example?

RBT
  • 24,161
  • 21
  • 159
  • 240
Unknown
  • 778
  • 1
  • 7
  • 16
  • can you still run dotnet build in jenkins ? –  Apr 13 '19 at 11:39
  • In order to build .NET Core projects, you will have to have the .NET Core SDK installed on the build server. I’d suggest you to look at one of the _many_ examples on how to build .NET Core projects with Jenkins that you will find via Google. – poke Apr 13 '19 at 14:58

1 Answers1

1

To build .NET Core (aka .NET) project on build server, I'm using MSBuild task with following settings:

enter image description here

Then, you can run below command to publish it:

dotnet publish $(Build.SourcesDirectory)/YourDotNetCoreProject.csproj --configuration Release

I'm using Visual Studio 2019 on my build server.

RBT
  • 24,161
  • 21
  • 159
  • 240