AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

"dotnet" exited with code -2147450730 #84

Closed Pzixel closed 6 years ago

Pzixel commented 6 years ago

I cannot build latest master locally. I also have the same problem when trying to build any project based on the nuget package (e.g. Solidity.Roslyn)

1>------ Build started: Project: CodeGeneration.Roslyn.Tests, Configuration: Debug Any CPU ------
1>C:\Users\pzixe\Documents\Repos\CodeGeneration.Roslyn\src\CodeGeneration.Roslyn.Tasks\build\CodeGeneration.Roslyn.BuildTime.targets(20,5): error MSB6006: "dotnet" exited with code -2147450730.
1>Done building project "CodeGeneration.Roslyn.Tests.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 7 up-to-date, 0 skipped ==========

Complete detailed log: https://gist.github.com/Pzixel/59c93760658f92ccb49908186cd76020

amis92 commented 6 years ago

I think the actual error is found here: https://gist.github.com/Pzixel/59c93760658f92ccb49908186cd76020#file-output-txt-L4636

1> It was not possible to find any compatible framework version 1> The specified framework 'Microsoft.NETCore.App', version '1.0.5' was not found. 1> - Check application dependencies and target a framework version installed at: 1> C:\Program Files\dotnet\ 1> - Installing .NET Core prerequisites might help resolve this problem: 1> http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 1> - The .NET Core framework and SDK can be installed from: 1> https://aka.ms/dotnet-download 1> - The following versions are installed: 1> 2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1> 2.1.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

You may want to install .NET Core SDK again, which should install 1.0.5 (or newer) runtime.

Pzixel commented 6 years ago

Well, I have netcore 2.0 and 2.1 installed. I also have seen this error, but it 1.x version should be compatible, isn't it? I have clean reinstall of the whole OS so environment settings shouldn't be the problem.

amis92 commented 6 years ago

I haven't reproduced this error. It seems that the DotNetCliTool dotnet-codegen can't restore the required dependency package of Microsoft.NETCore.App,1.0.5, for some reason.

Seeing as I can't reproduce it and you can, I don't know what is the actual problem, but it has to be an environment issue.

amis92 commented 6 years ago

My C:\Program Files\dotnet directory looks like that:

image

Pzixel commented 6 years ago

@amis92

pzixe@ZPC MINGW64 /c/Program Files/dotnet/sdk
$ ls
2.1.202/  2.1.400/  NuGetFallbackFolder/

Seeing as I can't reproduce it and you can, I don't know what is the actual problem, but it has to be an environment issue.

I do believe that it's rather the package itself require special environment setup. I suppose that it doesn't work if you don't have 1.X SDK (which I don't have and don't want to have one), this is why it does work for you but doesn't for me.

amis92 commented 6 years ago

I've compared dotnet-codegen package versions 0.4.49 and 0.4.62 and in terms of package manifest and deps.json, the only difference in that the lower one references Microsoft.NETCore.App v1.0.4, and the newer one - 1.0.5. So it doesn't seem to be a problem with the package. Can you confirm that using previous version (49) works?

Pzixel commented 6 years ago

I have the same error on 078476a7641d81246f63b52a2bdc267977b08e71.

It looks like it doesn't work at all if you don't have Core 1.x installed on the machine. It's not latest commits change or something, it's just because I previosly was compiling on machines where I didn't reinstall windows for years, so it had all netcore runtimes starting from 1.0. Now I installed a brand new instance with only latest netcore 2.1 and it seems to be the evil doer couldn't compile the test project.

amis92 commented 6 years ago

I think this might be resolved with inclusion of prefercliruntime file in the package: https://github.com/dotnet/docs/issues/7292

But since there's no real documentation, it's hard to know.

amis92 commented 6 years ago

@Pzixel can you check whether this would solve your issue (using CI-built package, or pull and build yourself)? https://github.com/AArnott/CodeGeneration.Roslyn/pull/85

AArnott commented 6 years ago

.NET Core's compatibility policy is that 2.0 never runs 1.0 I believe. That would explain why you can't run the tool without having the dot net core 1.0 runtime installed. I don't think it has anything to do with the version of your SDK. I'm curious why you object to installing the runtime as it isn't that big and installs very quickly. That all said, I'm surprised this targets Net core 1.0. I would not object to an update to target Net core 2.0.

AArnott commented 6 years ago

Hmmm... Linux Mint 19 and Ubuntu 18 aren't even supported by the .NET Core 1.x runtime. I tried installing it anyway and it failed at runtime. So I guess that's a very compelling reason to get this working on .NET Core 2.0.

AArnott commented 6 years ago

I verified this fix and am publishing to nuget.org now as 0.4.65.