question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No way to add ref/lib split assets to deps files outside a nuget package

See original GitHub issue

I tried setting Reference (Private=false) and ReferenceCopyLocalPaths, same as what NuGet does, and noticed that the runtime assembly in ReferenceCopyLocalPaths was not added to the deps file.

I checked the inputs to GenerateDepsFile and there doesn’t appear to be one for runtime-only dependencies.

/cc @eerhardt

Here’s the sample I was trying to make work:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Windows">
      <HintPath>C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.15063.0\Windows.winmd</HintPath>
      <Private>false</Private>
    </Reference>
  </ItemGroup>

  <!-- reference these so that they are downloaded, but exclude all assets so that we can reference manually  -->
  <PropertyGroup>
    <UapRefPackage>Microsoft.Private.CoreFx.UAP</UapRefPackage>
    <UapLibPackage>runtime.win10-x64.Microsoft.Private.CoreFx.UAP</UapLibPackage>
    <PrivateUAPVersion>4.4.0-preview2-25405-01</PrivateUAPVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="$(UapRefPackage)" Version="$(PrivateUAPVersion)" ExcludeAssets="all" />
    <PackageReference Include="$(UapLibPackage)" Version="$(PrivateUAPVersion)" ExcludeAssets="all" />
    <!-- manually reference the WinRT assemblies -->
    <Reference Include="$(NuGetPackageRoot)$(UapRefPackage)\$(PrivateUAPVersion)\ref\uap10.1\System.Runtime.WindowsRuntime.dll" Private="false" />
    <ReferenceCopyLocalPaths Include="$(NuGetPackageRoot)$(UapLibPackage)\$(PrivateUAPVersion)\runtimes\win10-x64\lib\uap10.1\System.Runtime.WindowsRuntime.dll" />
  </ItemGroup>
</Project>

This is a bit of a hack, but I could imagine folks trying to do similar stuff.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
ericstjcommented, Jun 14, 2017

That appears to make compile work, but not run. GenerateDepsFile doesn’t read the items to determine what to put in the deps file from packages, it just flows what NuGet put in there and “ExcludeAll” removed everything NuGet put in there.

Regardless, I’m not necessarily looking for a more elegant way to filter this NuGet package (although that is somewhat interesting). I’m looking for how we’d enable someone outside of a package having a different ref vs lib asset and having that work with the deps file.

1reaction
davkeancommented, Jun 14, 2017

We talked about this at standup, basically you would get most features for free if you just produced the same FileDefinitions instead of references as the NuGet asset raising task. Which would also make the grouping under the right SDK node work correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PackageReference in project files - NuGet
Add a dependency in your project file using the following syntax: ... Using PackageReference for a project with no package dependencies.
Read more >
Assets file project.assets.json not found. Run a NuGet ...
The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required...
Read more >
Creating NuGet Packages the easy way with .NET Standard in C
NuGet packages are a way to share versioned code with the world. If you have done any development in C#, you have used...
Read more >
Resolve NuGet dependency conflicts
Describes why package dependencies can create compatibility issues and how to work around those issues in the Project SDK (PackageReference) model.
Read more >
Studio - Managing Activities Packages
In the Source field, type the local drive folder pathway, the shared network folder pathway or the URL of the NuGet feed. Click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found