HTTP Error 502.5 - Process Failure after ASP.NET Core Publish

I received the following error after trying to publish an ASP.NET core site after upgrading my solution to Visual Studio 2017 and ASP.NET Core 1.1.
HTTP Error 502.5 - Process Failure after ASP.NET Core Publish
The logs from my site indicated a lot of BadImageException's which usually means you have x86 trying to call a x64 assembly or vice versa. In fact, when I went into my csproj file I could see I was targeting "win7-x86" for my RID (Runtime Identifier) but had "AnyCPU" choosen. When I changed the target to x86 my publish/site began working again. Here is more info on this common exception and more in regards to ASP.Net Core publishing: