sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Could not find exe from dependency package after dotnet publish

Open schellap opened this issue 10 years ago • 9 comments

Repro steps:

  1. Clear the NuGet cache (not for first run) or the cached ILCompiler folders for subsequent run.
  2. Unzip the temp.zip file to say H:\
  3. Issue dotnet restore as specified in command.txt (change the local paths as per your env)
  4. Issue dotnet publish as specified in command.txt (change the local paths as per your env)
  5. Open the H:\temp\publish directory.

The ILC.exe is missing which comes from the dependency of the packages declared in H:\temp\project\project.json

schellap avatar Jan 22 '16 03:01 schellap

Cc @davidfowl

It is not clear to me if I am doing something wrong... please advise.

schellap avatar Jan 22 '16 03:01 schellap

Taking a look at the project.lock.json

I see "runtimes/any/lib/dotnet/ilc.exe" is not longer an export, it only exists under the 'files' object.

@anurse Do you know if NuGet treats ".exe" files under lib differently?

@schellap ILC.exe is really an IL application right? You could just rename it ILC.dll and we can make the corresponding changes. Alternatively you could put it under the native piece and it will probably get picked up correctly again.

brthor avatar Jan 22 '16 03:01 brthor

@brthor, basically, does this mean, dotnet compile --native is not possible in the rel/1.0.0 branch?

schellap avatar Jan 22 '16 03:01 schellap

@schellap We still use dnu for restore currently so that's probably why we haven't seen this issue.

I think this means we need to make changes to make dotnet compile --native work right once we are using NuGet.

Either in the package & product if you rename to .dll or only in the package if you move to the native section (like we do for some of the other files)

brthor avatar Jan 22 '16 03:01 brthor

In general, what is the recommended layout to package this exe file? I believe changing to ilc.dll requires CLI changes as well.

schellap avatar Jan 22 '16 03:01 schellap

It looks like NuGet does not consider .exe a valid assembly. I'll submit a PR there to fix that.

https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Client/ManagedCodeConventions.cs#L35

analogrelay avatar Jan 22 '16 04:01 analogrelay

https://github.com/NuGet/NuGet.Client/pull/220

analogrelay avatar Jan 22 '16 04:01 analogrelay

In the case of all our other "executables" (NuGet, Csc, Fsc, etc.), the packages contain the managed executable as a dll and then the build script copies corehost in and renames as appropriate to make it runnable.

analogrelay avatar Jan 22 '16 04:01 analogrelay

@schellap looks like this got merged. Can you validate and reopen if this is still an issue?

TheRealPiotrP avatar Jan 27 '16 10:01 TheRealPiotrP