For a net461 project with RID as win7-x64, the dotnet-aspnet-codegenerator-design.exe causes exception as MVC tries to load the 32-bit assembly in a 64-bit process:
System.BadImageFormatException occurred
HResult=0x8007000B
Message=Could not load file or assembly 'dotnet-aspnet-codegenerator-design' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=mscorlib
Sample project:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>
cc @Eilon @mlorbetske
cc @pranavkm because MVC is in the mix here.
I might have been on an email thread related to this. The PR for this looks good.
This patch bug is approved for the 2.0.x patch. Please send a PR to the feature/2.0.1 branch and get it reviewed and merged. When we have the rel/2.0.1 branches ready please port the commit to that branch.
@Eilon Is there a workaround in the meantime?
The workaround is to remove the package reference Microsoft.VisualStudio.Web.CodeGeneration.Design (This will disable scaffolding)
From: https://github.com/aspnet/Mvc/issues/6709#issuecomment-324969596
Fixed by #605
Most helpful comment
@Eilon Is there a workaround in the meantime?