4

Error Message:

PM> Add-Migration InitialDatabase
dotnet exec needs a managed .dll or .exe extension. The application specified was 'C:\Users\xxxxxx\documents\visual studio 2017\Projects\TheWorld\src\TheWorld\bin\Debug\netcoreapp1.0\TheWorld.runtimeconfig.json'
Process finished with non-zero exit code
PM> 

Visual Studio Version: 2017 RC

Project Dependencies :

Project Dependencies

Error Screenshot : Error Screenshot

2
  • I'm having the same issue. Could you post an answer if you figure something out?
    – kamilk
    Dec 22, 2016 at 18:50
  • It worked after I installed .netcore 1.1 and changed the target framework to it.
    – bigyanshr
    Dec 29, 2016 at 14:54

5 Answers 5

6

I had the same problem. The only thing I had to do is changing the Target Framework in the Project properties.

Changing the framework version

I hope this helps.

2
  • Thank you very much. It turns out that the packages were expecting .netcore 1.1 but I had only .netcore 1.0 installed in my system. So, after instaling .netcore 1.1 and changing the framework, the issue was resolved. Thank you very much once again.
    – bigyanshr
    Dec 29, 2016 at 14:53
  • Thanks, again much time was saved (and I've had my share of figuring things out, so glad this at least was easy thanks to you :) )
    – Arwin
    Jan 20, 2017 at 15:40
1

In VS2017RC - All I had to do was install .NetCore again using Package Manager Console:

Install-Package Microsoft.NETCore.App

Later migration script worked and "dotnet exec needs a managed .dll or .exe extension." error went away.

0

Tooling for VS and dotnet are still in preview. Try run dotnet ef migrations add InitialDatabase from command line in TheWorld/src folder.

2
  • PM> Install-Package Microsoft.EntityFrameworkCore.Tools.DotNet -Pre Install-Package : Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final' has a package type 'DotnetCliTool' that is not supported by project 'src\TheWorld'. At line:1 char:1 + Install-Package Microsoft.EntityFrameworkCore.Tools.DotNet -Pre + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageComm
    – bigyanshr
    Dec 21, 2016 at 15:41
  • 1
    Thanks Dmitry. I tried installing entityframeworkcore.tools.dotnet . Error says dotnetclitool not supported by project .
    – bigyanshr
    Dec 21, 2016 at 15:43
0

My context was deploying to AWS Lambda.

The fix was to change the output type to Class Library in the EF project (EFCore) that my lambda was using.

p.s. you might need to change it back when you run migrations etc.

enter image description here

0

I had a similar issue deploying a docker container to AWS Lambda.

I was using a custom container and not the public.ecr.aws/lambda/dotnet:latest.

Because of this, thelambda-entrypoint.sh was getting confused about which deps.json to use and was trying to run dotnet exec on a random json file.

What ended up solving it was setting the environment variable LAMBDA_DOTNET_MAIN_ASSEMBLY to the main assembly name - not including .dll

This name should match the name of your .csproj file. For instance, if your program is myDotnetExample.csproj you would set the environment variable as:

LAMBDA_DOTNET_MAIN_ASSEMBLY = "myDotnetExample"

Once this variable was set, lambda-entrypoint.sh was able to find the proper file and run the program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.