Comments (5)
One workaround is to let ProjectB copy the assemblies to the output directory, but then copy the assemblies from there to a separate directory and exclude the indirect references from that copy. Microsoft.Build.Artifacts can be used for that.
from msbuild.
@General-Fault No - you are right, this is a known bug in MSBuild/sdk/nuget: dotnet/sdk#1366
Closing this as duplicate now
from msbuild.
Is this a correct problem statement?: You want to influence copying of PackageReference items from the referenced project (through ProjectReference) within the referencing project. E.g. you want PackageReference items from ProjectA not to be copied to output of referencing ProjectB, but to be copied to output of referencing ProjectC.
If that's correct - I do not believe it's supported today (but I'll dig further) - but can you workaround by specifying PrivateAssets
on the PackageReference items in ProjectA (so that they are excluded by referencing projects) and explicitly adding those to ProjectC (so that they are copied there)?
from msbuild.
Is this a correct problem statement?: You want to influence copying of PackageReference items from the referenced project (through ProjectReference) within the referencing project. E.g. you want PackageReference items from ProjectA not to be copied to output of referencing ProjectB, but to be copied to output of referencing ProjectC.
If that's correct - I do not believe it's supported today (but I'll dig further) - but can you workaround by specifying
PrivateAssets
on the PackageReference items in ProjectA (so that they are excluded by referencing projects) and explicitly adding those to ProjectC (so that they are copied there)?
Not quite... ProjectC in this case also has a reference to ProjectA and the necessary packages. In my use-case, ProjectA is a "common" assembly that includes shared interfaces. ProjectB is a runtime discoverable plugin. By the time the plugin is loaded by the ProjectC executable, the shared ProjectA.dll its dependencies have already been loaded. By this token, the PrivateAssets
approach is not usable here.
What I'm trying to do here is have the output directory for ProjectB (and installer generated from those outputs) only contain assemblies that are specific to that plugin and not the "common" assemblies also used by Project A and ProjectC.
For what it's worth, I think I may have solved my own problem using <IncludeAssets>compile</IncludeAssets>
in the ProjectReference
tag in ProjectB. So, is the "bug" here only in my head where I simply didn't understand the intention of the MSBuild developers? Or should <Private>False</Private>
imply that the dependencies of the referenced project also not be included in the output as I had expected?
from msbuild.
@KalleOlaviNiemitalo Thank you for pointing me toward Microsoft.Build.Artifacts! This probably isn't the ideal solution for the project that led to me filing this issue. However, this may solve another related challenge I'm facing.
from msbuild.
Related Issues (20)
- [Bug]: dotnet restore throws error NU1202 with dotnet sdk 8.0.300 for some centrally managed packages HOT 2
- [Feature Request]: Expand $(~) to $(HOME) or $(USERPROFILE) depending on OS HOT 4
- Got 'Insufficient system resources exist to complete the requested service' while building Store version of application
- [Feature Request]: Cache RoslynCodeTaskFactory compilations for the lifetime of the Server
- [Bug]: Cannot use Microsoft.Build.Utilities.Core 17.10.4 NuGet package HOT 4
- Correct way to generate sources for an external project (with incompatible `TargetFramework`)?
- [Feature Request]: Localize MSBuild messages with MSBuildInternalMessage task
- [Bug]: BuildCheck: Internal error thrown when reporting results HOT 1
- [Broken Build]: Blazor Integrity issue HOT 1
- [Bug]: NRE in at Microsoft.Build.BackEnd.TargetEntry.<ExecuteTarget>d__44.MoveNext() HOT 4
- Request to backport getResultOutputFile from 8.0.3xx to 8.0.1xx SDK. HOT 3
- [Bug]: CI/CD pipeline broken after update from 17.9 to 17.10: no Appx packages generated HOT 2
- [Bug]: OOM Exception due to infinite loop in FileMatcher HOT 2
- [Feature Request]: The way publish dll only HOT 5
- [Refactoring] Move all Xml*WithLocation to Microsoft.Build.Framework
- [Feature Request]: Reduce the wrapping around SDK Resolver messages when only one resolver is actually invoked HOT 1
- Analyzer for Property read before assigned HOT 2
- [Bug]: Incorrect framework library is used sometimes during build HOT 1
- Q: Need to know BumpAssemblyVersions targets integration, package versions migration HOT 22
- [Bug]: Project file does not exist with LongPaths HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msbuild.