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.

P2Ps should be allowed when ReferenceOutputAssembly=false even given TFM incompatibilities

See original GitHub issue

With VS2015 projects, I can have a P2P from a portable library to a net46 library by setting metadata on the project reference:

<ProjectReference Include="..\SomeNet46Lib\lib.csproj">
  <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>

But with the .NET SDK projects, even with this metadata the build fails:

C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): error : Project ‘C:\git\pinvoke\src\CodeGeneration\CodeGeneration.csproj’ targets ‘.NETFramework,Version=v4.6’. It cannot be referenced by a project that targets ‘.NETPortable,Version=v0.0,Profile=Profile92’. [C:\git\pinvoke\src\CodeGeneration\CodeGeneration.csproj]

This blocks scenarios where a P2P exists merely for the sake of ensuring build ordering but without the assembly reference. In my particular scenario, the referenced project provides a binary that the build of the portable library picks up for code generation purposes.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
rainersigwaldcommented, Aug 23, 2017

Workaround

Set

<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies>

in the project that has the ProjectReference to the incompatible project. This prevents the elevation of solution build dependencies to ProjectReferences in AssignProjectConfiguration.

(Was poking around near this target for another reason and saw this.)

1reaction
AArnottcommented, Mar 7, 2017

Yes, A is multi-targeted. And that additional metadata did the trick. Thanks.

Should we leave the issue active for making this scenario simpler, and/or work the way it used to?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backlog Milestone
Misleading error message when passing wrong argument to static method. ... P2Ps should be allowed when ReferenceOutputAssembly=false even given TFM ...
Read more >
Error DependsOnTargets. _collectBundleResourses
I have had upgrade inbetween. Still stuggling to get to know the system and feel of the interface. Visual Studio for MacSetup ...
Read more >
aarnott - CodeGeneration.Roslyn.Attributes 0.4.23
In this walkthrough, we will define a code generator that replicates any class (annotated with our custom attribute) with a suffix (specified in...
Read more >
30uamxd9zjrh.txt
-- Several properties must be set in the main project file, before using this .TARGETS file. However, if the properties are not set,...
Read more >
out.txt
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have created a backup copy. Incorrect changes to this file...
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