Replies: 1 comment
-
|
Hi, Both issues stem from the fact that ProjectReference and PackageReference items need to be evaluated at project evaluation time, not inside a target. When you add them dynamically inside a target:
Solution:
This way, NuGet and the IDE can resolve dependencies at evaluation time, and transitive packages will flow correctly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to add
ProjectReferenceorPackageReferenceon a condition with a target. I have csproj files including these:The condition property is set in
Directory.Build.props:And the target is implemented in
Directory.Build.targets:I have 2 problem with this approach:
ProjectReference. If the project uses nuget packages included in the referenced project withProjectReference, then build fails. Normally, if we setProjectReferencestatically in the csproj, we can use transitive nuget packages in that reference, but I couldn't overcome the unresolved nuget package errors with above dynamically addedProjectReference.ProjectReferencenorPackageReferenceaccording toUseLocalNuGetProjectsproperty.How can I solve these two problems?
By the way I've tried many targets in
BeforeTargetslikeResolveProjectReferencesDesignTime2,CompileDesignTime,ResolveProjectReferences,ResolvePackageDependencies,Compile, etc, but no luck.Best Regards.
Beta Was this translation helpful? Give feedback.
All reactions