question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

net461 version of dotnet-aspnet-codegenerator-design.exe should be built for multiple platforms instead of win7-x86

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
tjrobinsoncommented, Sep 18, 2017

@Eilon Is there a workaround in the meantime?

1reaction
tjrobinsoncommented, Oct 5, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

net461 version of dotnet-aspnet-codegenerator-design.exe ...
net461 version of dotnet-aspnet-codegenerator-design.exe should be built for multiple platforms instead of win7-x86 #601.
Read more >
Cross-platform targeting for .NET libraries
The best way to call framework-specific APIs is using multi-targeting, which builds your project for many .NET target frameworks rather than for ...
Read more >
Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
Rider: The Cross-Platform .NET IDE from JetBrains
NET IDE based on the IntelliJ platform and ReSharper. ... debugging multiple runtimes, Rider itself runs on multiple platforms: Windows, macOS, and Linux....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found