0

Assume Project A produces a primary assembly but also some assemblies through the use of an MSBuild task (of our own making).

Is there a way for Project B, that has a ProjectReference to Project A, to also reference the assemblies that are produced by the task without hacking too much (I know, quite relative concept ;-))?

1 Answers1

0

By convention a project has one primary target that it is responsible for producing, although that can be multiple related files. e.g. A MyLib.csproj may produce a MyLib.dll with supporting MyLib.pdb and MyLib.dll.config files. In general, files of certain known file extensions that match the name of the project target are associated together.

A ProjectReference will bring in the primary target assembly of the referenced project, files directly associated with the target assembly (e.g. the .pdb and .config), and one depth of assemblies (and their associated files) that are linked to by the primary target assembly.

If you have created a project with 'multiple outputs' then you will also have to create the support to reference the 'multiple outputs'.

Jonathan Dodds
  • 2,654
  • 1
  • 10
  • 14
  • > If you have created a project with 'multiple outputs' then you will also have to create the support to reference the 'multiple outputs'. Yes, but how. That's the question ;-) In our case we compile some JScript using jsc.exe as a sideshow to the primary target. Any project that references this projects primary target also has to reference that secondary lib. – Brumlemannen Jan 06 '23 at 11:45
  • jsc is producing a .NET assembly, correct? If yes, then the JScript code and jsc process might be moved to its own project. The 'primary' project can reference via a `ProjectReference`. MSBuild 'SDK-Style' projects support different 'project SDKs' which are essentially sets of targets and tasks for specific workloads. Anyone can write an SDK and share on NuGet. It is possible that a project SDK has been created for JScript .NET. VS2022 added a new .esproj (ECMAScript project) which may work for you (but seems geared to node and react). – Jonathan Dodds Jan 06 '23 at 17:01