Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running selected code generator. The given assembly or codebase was invalid. #586

Closed
lee-alderdice opened this issue Aug 7, 2017 · 4 comments

Comments

@lee-alderdice
Copy link

Hi,

I am running into the error below when scaffolding a controller and views in VS2017. My csproj is at the bottom. I am not sure how to fix this, so far I have tried:

  • Different version of Wed.CodeGeneration.
  • Different Package and DotNetCliToolReference configurations

Any help greatly appreciated.

Thanks.

image

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <OutputType>Exe</OutputType>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
    <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">1.1.1</RuntimeFrameworkVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="BundlerMinifier.Core" Version="2.2.306" />
    <PackageReference Include="jquery.datatables" Version="1.10.15" />
    <PackageReference Include="MailKit" Version="1.10.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Localization" Version="1.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Localization" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="1.1.1" />
    <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.0.1" />
    <PackageReference Include="WnvHtmlToPdf_NetCore_Client" Version="14.0.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" />
  </ItemGroup>
  <ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>
</Project>

@prafullbhosale
Copy link
Contributor

@lee-alderdice, I was able to repro the issue with the csproj you provided.

I had to make the following modification to get scaffolding to work:

Remove the below package references:

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="1.1.1" /> 
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="1.1.1" />

The above packages are brought in transitively by Microsoft.VisualStudio.Web.CodeGeneration.Design, so you should not refer to them directly.

Let me know if this helps.

@lee-alderdice
Copy link
Author

Hi @prafullbhosale that has worked. Thank you so much. I have been looking on the web for a long time to get to this point.

@lee-alderdice
Copy link
Author

lee-alderdice commented Sep 21, 2017

Sorry to reopen this but I find once again that the ability to scaffold controllers and views has disappeared and the error message No executable ... dotnet-aspnet-codegenerator.

I am on VS2017 15.3.4
My .csproj has just this package Microsoft.VisualStudio.Web.CodeGeneration.Design at version 1.1.2 and tooling Microsoft.EntityFrameworkCore.Tools.DotNet at version 1.1.0-preview4-final.

I have checked on VS2017 developer community and can't find anything that might intimate what is wrong at this time.

@lee-alderdice lee-alderdice reopened this Sep 21, 2017
@vijayrkn
Copy link
Contributor

vijayrkn commented Nov 9, 2019

This should be fixed in the latest versions.

@vijayrkn vijayrkn closed this as completed Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants