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.

Project.json's "copyToOutput" isn't transitive

See original GitHub issue

Steps to reproduce

Have ProjectA which defines a "copyToOutput" element within its "buildOptions" section in project.json. When compiled, the file or files in the "include" section will be copied to the output, along with ProjectA.dll. ProjectA project.json (“include”: [“ProgramA.cs”] is just as an example)

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true,
    "copyToOutput": {
      "include": ["ProgramA.cs"]
    }
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-*"
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

ProgramA.cs

using System;
namespace ProjectA
{
    public class ClassFromProjectA
    {
        public int Value { get; set; } = 3;
    }
}

Now, have ProjectB which includes ProjectA as a reference. When compiled, it will produce ProjectB.dll as well as ProjectA.dll in the output directory. ProjectB project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "ProjectA": "1.0.0-*",
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-*"
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

ProgramB.cs

using System;
using ProjectA;
namespace ProjectB
{
    public class ProgramB
    {
        public static void Main(string[] args)
        {
            var r = new ClassFromProjectA();
            Console.WriteLine($"Value from ProjectA {r.Value}");
        }
    }
}

Expected behavior

The files specified by the "copyToOutput" element of ProjectA show up in the output directory of ProjectB. Furthermore, I expect that the output directory for ProjectA also contains the files.

Actual behavior

The files included by the "copyToOutput" element of ProjectA will not be copied to the output of ProjectB, or the output directory of ProjectA. The files will only be copied to the output when the root compilation project is the one specifying the "copyToOutput" element, and it will only work on the files included by the root compilation project.

Environment data

dotnet --info output: .NET Command Line Tools (1.0.0-rc2-002659)

Product Information: Version: 1.0.0-rc2-002659 Commit Sha: 11a001706f

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Joshscorpcommented, Aug 11, 2016

Yeah when will we expect a fix? Need it.

2reactions
andyleejordancommented, Jun 1, 2016

@xoofx I’m in a really similar situation. It’s caused me to write cross-platform scripts around dotnet just to distribute files, when it should be able to pick them up automatically. 😢

Read more comments on GitHub >

github_iconTop Results From Across the Web

Project.json's "copyToOutput" isn't transitive · Issue #6001
json . When compiled, the file or files in the "include" section will be copied to the output, along with ProjectA.dll .
Read more >
Dependent DLL is not getting copied to the build output ...
json.dll) where the build output doesn't include the referenced DLL. But the compilation goes thru fine. Fix: Go through your projects in ...
Read more >
Project Configuration
We can specify the glob pattern to match only the subset of the output files. The transitive parameter defines whether the check and...
Read more >
deps.json not published for projects referenced for XUnit ...
Api.deps.json file from your application's output directory must be copied to the folder where the tests are running on.
Read more >
Efficient JSON serialization with Jackson and Java
The Jackson open source library for JSON works with many programming languages.
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