sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Could not find file _._ while trying to dotnet publish

Open mmalolepszy opened this issue 10 years ago • 26 comments

Steps to reproduce

  • dotnet new
  • Edit project.json:
{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-rc2-23931"
    }
  },
  "frameworks": {
    "netstandardapp1.5": {}
  },
  "runtimes": {
    "win7-x64": {},
    "ubuntu.14.04-x64": {}
  }
}
  • dotnet restore
  • dotnet publish

Expected behavior

Published to C:\project\bin\Debug\netstandardapp1.5\win7-x64\publish
Published 1/1 projects successfully

Actual behavior

Could not find file 'C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.DotNetHost\1.0.0-rc2-00001\runtimes\win7-x64\native\_._'.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-beta-002202)

Product Information:
 Version:     1.0.0-beta-002202
 Commit Sha:  60b23d5115

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

Additional info

  • Publish succeedes after creating _._ files in
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.DotNetHost\1.0.0-rc2-00001\runtimes\win7-x64\native
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy\1.0.0-rc2-00001\runtimes\win7-x64\native
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver\1.0.0-rc2-00001\runtimes\win7-x64\native
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.2-rc2-23931\runtimes\win7-x64\native
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets\1.0.1-rc2-23931\runtimes\win7-x64\native
C:\Users\<my-user>\.nuget\packages\runtime.win7-x64.runtime.native.System.IO.Compression\4.0.1-rc2-23931\runtimes\win7-x64\native
  • Similar behavior can be observed on Ubuntu 14.04. dotnet --info:
.NET Command Line Tools (1.0.0-beta-002202)

Product Information:
 Version:     1.0.0-beta-002202
 Commit Sha:  60b23d5115

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  14.04
 OS Platform: Linux
 RID:         ubuntu.14.04-x64

mmalolepszy avatar Apr 04 '16 11:04 mmalolepszy

@schellap looks like a host packaging issue

TheRealPiotrP avatar Apr 05 '16 04:04 TheRealPiotrP

@weshaggard any ideas here? I know this _._ is a placeholder, but are these expected to be present in the package?

schellap avatar Apr 06 '16 19:04 schellap

cc @ericstj

Yes placeholder files should be present in the package as they are used as markers by nuget to mean there is no asset.

weshaggard avatar Apr 06 '16 19:04 weshaggard

This happens for all native packages, coreclr, apisets, host sub packages... I will talk to @ericstj what this is about.

schellap avatar Apr 06 '16 19:04 schellap

@Sridhar-MS Assigned to you since you are looking into this.

gkhanna79 avatar Apr 06 '16 20:04 gkhanna79

@mmalolepszy can you please remove

      "type": "platform",

Currently you cannot have that along with RID's specified. @anurse this error message needs to be fixed so we don't get into this situation or we need to teach publish to handle it correctly.

weshaggard avatar Apr 06 '16 20:04 weshaggard

None of these actually require placeholders since they have actual content in that directory in the package.

ericstj avatar Apr 06 '16 20:04 ericstj

Currently you cannot have that along with RID's specified.

You sure can. That enables the non-portable-but-shared-framework scenario. This error was caused by something else, and I think @pakrym fixed it. Does it still repro on the latest builds?

analogrelay avatar Apr 06 '16 20:04 analogrelay

Ah, I've seen this before. The file exists, but NuGet is dropping a placeholder in the lock file. This may be a NuGet bug.

analogrelay avatar Apr 06 '16 20:04 analogrelay

@petermarcu hit this yesterday.

@krwq you're finishing up dotnet/cli#2198 which repros the issue. Are you still seeing it?

TheRealPiotrP avatar Apr 06 '16 20:04 TheRealPiotrP

@emgarten adding you in case this is a Nuget issue.

TheRealPiotrP avatar Apr 06 '16 20:04 TheRealPiotrP

To be clear, @pakrym 's change should remove the immediate error since he filters out _._ files during publish. However, this is still a bug, since there should be a file in the lock file but we're getting a placeholder instead

analogrelay avatar Apr 06 '16 20:04 analogrelay

I am not able to repro this with a later version 1.0.0-beta-002222.

When did @pakrym changes go in?

Sridhar-MS avatar Apr 06 '16 20:04 Sridhar-MS

https://github.com/dotnet/cli/commit/87ee62c282b9124ec2f63bbd7cb3963cbbd0c4b7

pakrym avatar Apr 06 '16 20:04 pakrym

Cc @brthor the errors you saw the other day (and Compilation Failed)...

schellap avatar Apr 06 '16 21:04 schellap

The bug is no longer reproing with @pakrym 's fix - https://github.com/dotnet/cli/commit/87ee62c282b9124ec2f63bbd7cb3963cbbd0c4b7

I think there is still an underlying nuget restore bug. If a project.json contains type: platform and the runtimes node too, then restore drops the placeholder _._ into the lock file even though files are present in the nuget package.

Example:

"runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.2-rc2-23931": {
        "type": "package",
        "compile": {
          "ref/netstandard1.0/_._": {}
        },
        "runtime": {
          "runtimes/win7-x64/lib/netstandard1.0/_._": {}
        },
        "native": {
          "runtimes/win7-x64/native/_._": {}
        }
      },

Sridhar-MS avatar Apr 06 '16 23:04 Sridhar-MS

The placeholder _._ is added to the lock file so that compatibility can be checked outside of NuGet. Looks like this has already been fixed, but it is expected that consumers of the lock file understand the _._ convention.

emgarten avatar Apr 07 '16 05:04 emgarten

Are these useful in the deps file? I saw them show up there, and the host thinks it is an asset. If they don't serve any purpose don't put in the deps file.

schellap avatar Apr 07 '16 06:04 schellap

They need to be there to replicate package structure. For instance of a package includes a DLL on win7 but that DLL is part of the operating system on win8. Host shouldn't try to load package copy.

ericstj avatar Apr 07 '16 14:04 ericstj

Yeah, the _._ indicates that the host should match that section as an asset, but ignore it and not add anything to the TPA/Native Search Path lists. It implies that the assembly/library is already going to be loadable (in Desktop, that means the GAC, on Core that means the shared framework, or in the case of a native library, an OS-specific library search path).

analogrelay avatar Apr 07 '16 17:04 analogrelay