reinforced / Reinforced.Typings

Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
MIT License
505 stars 81 forks source link

[MSB6003] The specified task executable "" could not be run. #106

Closed eliottrobson closed 5 years ago

eliottrobson commented 5 years ago

I have recently updated to version 1.5.0 and am now receiving the following error:

Reinforced.Typings.targets(59, 3): [MSB6003] The specified task executable "" could not be run. No such file or directory

Is there a known fix or anything I can do to get more information about what is happening?

pavel-b-novikov commented 5 years ago

Most likely problem is that it is not possible to identify which target framework you use from build process. Use RtForceTargetFramework in Reinforced.Typings.settings.xml

eliottrobson commented 5 years ago

I have added <RtForceTargetFramework>netcoreapp2.1</RtForceTargetFramework> but it has the same error.

pavel-b-novikov commented 5 years ago

Then I need to know more details about your environment. I have VS 2017 and everything works as expected. Other users too. I see several potential causes. And they are most likely because you use Rider or something like that. I could presume, taking your error message into account, that there is lack of MSBuildThisFileDirectory variable, but again - it is difficult to say exactly until I know the details. Will be best if you contact me via skype or email.

eliottrobson commented 5 years ago

I use MacOS and Rider IDE. I can post my RT config file if that helps? I am using .NET Core v2.1.6 and SDK 2.1.500

I can probably upgrade to v2.2.1 and SDK 2.2.102 if that would help?

pavel-b-novikov commented 5 years ago

I do not have ability to test it on Mac, so it will make sense to contact via Skype/TV.

eliottrobson commented 5 years ago

Okay, I will message you when I get home tonight and I'll do some more research today.

pavel-b-novikov commented 5 years ago

stayin' in touch

eliottrobson commented 5 years ago

I have also tried building using Visual Studio Mac and I get the same albeit more detailed error.

/Users/eliottrobson/.nuget/packages/reinforced.typings/1.5.0/build/Reinforced.Typings.targets(3,3): Error MSB6003: The specified task executable "" could not be run. ApplicationName='dotnet.exe', CommandLine=' "/Users/eliottrobson/.nuget/packages/reinforced.typings/1.5.0/tools/netcoreapp2.1/rtcli.dll" profile "/var/folders/j5/xc_tyl5j1t97f3bdqhxc6vpm0000gn/T/tmp628a4eaf.tmp"', CurrentDirectory='', Native error= Cannot find the specified file (MSB6003) (App.Web)

I'm not sure if that is more helpful? Is there anyway for me to see more detailed logs?

The thing that sticks out to me is that it should be dotnet not dotnet.exe on mac / core. I''ll have a look into the code to see what might be happening.

pavel-b-novikov commented 5 years ago

Well, it sounds like very specific nix-system problem

eliottrobson commented 5 years ago

I have done some more research, let me know what you think.

The only reference to dotnet.exe I can find is in the file Reinforced.Typings/Reinforced.Typings.Integrate/RtCli.cs https://github.com/reinforced/Reinforced.Typings/blob/32597244e129b2939872686101d8d239c957197a/Reinforced.Typings.Integrate/RtCli.cs

I can be fairly confident that IsCore is returning correctly because rtcli.exe is not referenced.

Therefore, I think that the issue lies in #if NETCORE I have decompiled reinforced.typings.1.5.0.nupkg\build\netstandard2.0\Reinforced.Typings.Integrate.dll

and I see the following code

protected override string GenerateFullPathToTool()
{
    if (this.IsCore)
        return "dotnet.exe";
    return Path.Combine(this.GetProperRtcliPath(), this.ToolName);
}

This accurately maps to a false evaluation of the if directive when compiling for netstandard.

I have checked the Reinforced.Typings/cake/build.cake file and I notice that the IntegrateProject does NOT have a corresponding RtAdditionalConstants section like the other files do.

if (netCore.Contains(fw)){
    mbs = new DotNetCoreMSBuildSettings()
        .WithProperty("RtAdditionalConstants","NETCORE;" + fw.ToUpperInvariant().Replace(".","_"))
        .WithProperty("RtNetCore","True");
}

Is it possible that this just needs adding to the build process?

romansp commented 5 years ago

Hi, I'm hitting exact same issue with 1.5.0 on MacOS. Minimal repro available here: https://github.com/romansp/reinforced-task-not-found It works fine when running on Windows.

Build Log
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 35.45 ms for /Users/roman.pavlov/Documents/dev/reinforced/reinforced.csproj.
/Users/roman.pavlov/.nuget/packages/reinforced.typings/1.5.0/build/Reinforced.Typings.targets(59,3): error MSB6003: The specified task executable "" could notbe run. No such file or directory [/Users/roman.pavlov/Documents/dev/reinforced/reinforced.csproj]

Build FAILED.

/Users/roman.pavlov/.nuget/packages/reinforced.typings/1.5.0/build/Reinforced.Typings.targets(59,3): error MSB6003: The specified task executable "" could notbe run. No such file or directory [/Users/roman.pavlov/Documents/dev/reinforced/reinforced.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.08

Thanks @eliottrobson for digging deep into this issue. Let me know if you need any help.

pavel-b-novikov commented 5 years ago

I have checked the Reinforced.Typings/cake/build.cake file and I notice that the IntegrateProject does NOT have a corresponding RtAdditionalConstants section like the other files do.

Holy fck... You're right

eliottrobson commented 5 years ago

I tried to test if adding that would work but couldn't setup my environment correctly. This is the tool I used on Windows (free) to decompile the code. https://www.jetbrains.com/decompiler/. If you need to check that the generated code is correct it's a nice easy way to see what the actual output is.

pavel-b-novikov commented 5 years ago

Thanks. I like JetBrains products and use dotPeek since it 1st version. Tomorrow I will revise MSBuild task logic and update version. Main problem is that I do not have available Mac machine to test RT and other projects. So it would be nice if I could contact someone further to obtain details about using RT on MacOS.

pavel-b-novikov commented 5 years ago

Fixed in version 1.5.1. Tested on VM with Ubuntu 18.10