Open ivanwick opened 6 years ago
cc @dsplaisted to help with a workaround.
@dsplaisted @nguerrera Hypothesis: I think an issue here is also that NuGet doesn't use the same property exclusions as project reference builds use.
NuGet does <GetRestoreProjectReferencesTask …ProjectReferences="@(ProjectReference)">
while MSBuild has logic to carefully unset some global properties (PrepareProjectReferences
> @(AnnotatedProjects)
), including RuntimeIdentifier
.
I believe that NuGet and MSBuild evaluation will then see a different list of global properties. Is that correct?
cc @peterhuene
It looks like this may be the same issue as, or related to, https://github.com/dotnet/sdk/issues/1834
As a workaround, you can try putting the following in the referenced Exe project:
<PropertyGroup>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
(You can also set the property to false if you don't intend to publish that project as self-contained).
@dsplaisted unfortunately that fix didn't work for me, i am getting:
error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. Please either specify a RuntimeIdentifier or set SelfContained to false.
If i get diag logs, i can see that runtime identifier has been unset for the dependent exe project :/
Any news or workaround in this topic? There is the same behavior for netcoreapp3.1
@wolszakp sorry. This is not something we have prioritized at the moment.
Steps to reproduce
Actual behavior
publish fails with
Expected behavior
Produce a self-contained executable in projA\out\projA.exe
projA.exe will start at projA's entry point but it may call code in projB.
Understood that the SCD should use the latest runtime patch available on my machine, which is 2.1.1. This is according to docs on Self-contained deployment runtime roll forward.
Note that if projB's
OutputType
is changed toLibrary
instead ofExe
then the publish succeeds. But we expect that a P2P reference from oneExe
to anotherExe
should also work because in a different build scenario, we may still want to publish projB as a separate self-containedExe
.Ideally, the shared code could be reorganized into a third
Library
project which is a dependency to both, but in this case, projA refers directly to projB. Is this supported?publish
in step 5 implicitlyrestore
s projA and its dependency projB. projA is treated as a SCD according the command line arguments, but I guess projB somehow does not get the same SelfContained or RuntimeIdentifier flags since its runtime is not rolled forward. I've seen other issues discussing how the RID gets passed through (#9514) but this seems to be a different problem where projB'sOutputType
as anExe
is significant.Environment data
dotnet --info
output: