-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Built-in analyzer] Flag shared evaluations between restore and build targets #9553
Comments
The error should be clear that just having different evaluations is not enough, they have to be in separate executions. |
@rainersigwald I'm a bit unclear on what that means. Does that mean that this is not a valid workaround? <Target Name="RestoreBuildAndPublishSubproject">
<MSBuild Projects="SomeSubproject.csproj"
Properties="Configuration=$(NativeLibsPublishConfiguration);RuntimeIdentifier=$(OutputRID);NativeLib=$(NativeLibKind);_RandomPropertyToPleaseMSBuild=Restoring"
Targets="Restore" />
<MSBuild Projects="SomeSubproject.csproj"
Properties="Configuration=$(NativeLibsPublishConfiguration);RuntimeIdentifier=$(OutputRID);NativeLib=$(NativeLibKind);_RandomOtherPropertyToPleaseMSBuild=BuildingAndPublishing"
Targets="Build;Publish" />
</Target> |
@lambdageek correct. The failure mode is:
Inside 4, the timeline goes like
We considered allowing invalidating the XML cache in that scenario but it turns out to be load-bearing for some cases including Live Unit Testing and some builds that try to bump their own version mid-build. Things work most of the time because it's not super common to bump the versions of packages that have build logic . . . but that's not 100%. |
See https://github.com/dotnet/runtime/blob/6d0a902c9585d98bfa44f514bac21a47eabe02fa/eng/testing/workloads-testing.targets#L195-L200 as an example.
Because the Restore and Pack target pass the same set of properties in, the underlying project evaluation evaluation is shared. This resulted in msbuild files restored via a
PackageReference
not being imported during the build.I have been fixing so many of these code pieces in my career at Microsoft and it would really be helpful if msbuild could somehow indicate that a shared evaluation between
Restore
andBuild
orPack
is most certainly wrong. Sure, there are cases where a shared evaluation might be intentional, but that should < 1%.Related: #2811
cc @akoeplinger @ericstj
The text was updated successfully, but these errors were encountered: