.NET Core - MVC

Observations about .NET Core, MVC and converting YetaWF from ASP.NET MVC5 to .NET Core MVC. The new .NET Core has great new features. Getting there from an existing MVC 5 app is HARD!

Dotnet Publish Creates Invalid EXE

10/06/2019

Upgrading to ASP.NET Core 3.0 went pretty smoothly overall, and first indications show overall page load time improved by nearly 20%. Given there were no changes to YetaWF, I have to assume that's all thanks to 3.0, maybe endpoints?

But then it came time to publish the first site. And it didn't work. Investigation showed, the EXE on Windows 10 built for deployment with IIS simply did not load. It pretended to run, but it didn't.

I noticed I had an <OutputType> tag in my Website project file:

  <PropertyGroup>
    <DefineConstants>DEBUG;MVC6;NETCOREAPP2_0;NETCOREAPP</DefineConstants>
    <WarningLevel>4</WarningLevel>
    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
    <ApplicationIcon />
    <OutputType>WinExe</OutputType>
    <StartupObject />
  </PropertyGroup>

Once that was removed, dotnet publish worked like a charm and created a proper EXE.

Go figure. It seems like this MSBUILD option breaks dotnet publish.

No Comments

Be the first to add a comment!

Add New Comment

Complete this simple form to add a comment to this blog entry.