have tried upgrading to the professional version of visual studio 2017 v 15.6.0 (Preview 7.0)
and installed aspnetcore-runtime-2.1.0-preview1-final-win-x64 and .net
Stopping IIS for publishing solved the problem. But first I needed to install net core 2.1 SDK and update the Visual Studio.