dotnet aspnet-codegenerator failing on Linux
See original GitHub issueHi,
I created a new webapi application with dotnet cli and I’m trying to scaffolding with dotnet aspnet-codegenerator but it’s failing.
Here’s the error:
Command Line: --project . controller -name PacientesController -m Paciente -outDir Controllers/
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
/mnt/docs/dev/acs/acs.csproj : error MSB4057: The target "EvaluateProjectInfoForCodeGeneration" does not exist in the project.
Unhandled Exception: System.InvalidOperationException: Failed to get Project Context for /mnt/docs/dev/acs/acs.csproj.
at Microsoft.Extensions.ProjectModel.MsBuildProjectContextBuilder.Build()
at Microsoft.VisualStudio.Web.CodeGeneration.Tools.Program.GetProjectInformation(String projectPath, String configuration)
at Microsoft.VisualStudio.Web.CodeGeneration.Tools.Program.BuildAndDispatchDependencyCommand(String[] args, String projectPath, String buildBasePath, String configuration, Boolean noBuild, ILogger logger)
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.Tools.Program.Main(String[] args)
my .csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Msbuild" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.Caching.SqlConfig.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
</Project>
dotnet --info
.NET Command Line Tools (1.0.1)
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: opensuse
OS Version: 20170331
OS Platform: Linux
RID: opensuse.13.2-x64
Base Path: /opt/dotnet/sdk/1.0.1
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (7 by maintainers)
Top Results From Across the Web
dotnet aspnet-codegenerator failing on Linux · Issue #444
Hi, I created a new webapi application with dotnet cli and I'm trying to scaffolding with dotnet aspnet-codegenerator but it's failing.
Read more >c# - aspnet-codegenerator could not execute
"Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet ......
Read more >dotnet aspnet-codegenerator command
Description. The dotnet aspnet-codegenerator global command runs the ASP.NET Core code generator and scaffolding engine. Arguments.
Read more >Scaffolding code generator does not work on Linux OS
It looks like we have a good news with this issue and it should be fixed in the latest dotnet-aspnet-codegenerator tool and Microsoft....
Read more >NETSDK1005 – update dotnet aspnet-codegenerator – Do That
I had updated dotnet SDK and runtime but not aspnet-codegenerator (which ... this is some kind on Linux specific aspnet-codegenerator issue.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@thild, I have found the issue. I will create a PR for the fix. In the meanwhile a workaround you can try is as below: Locate
*.codegeneration.targets
under yourproject_directory/obj/
Replace the below
with
Note this file gets generated when run scaffolding the first time on a project.
Closing this as the fix is available in version
1.0.1
ofMicrosoft.VisualStudio.Web.CodeGeneration.Tools
You can update the version in the .csproj file<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
Feel free to reopen this if you still see the issue after upgrading.