Skip to content
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

CSWinrt does not support ready to run #442

Closed
wli3 opened this issue Sep 28, 2020 · 6 comments
Closed

CSWinrt does not support ready to run #442

wli3 opened this issue Sep 28, 2020 · 6 comments
Assignees
Labels
pri-0 Blocking/issue has no workaround
Milestone

Comments

@wli3
Copy link

wli3 commented Sep 28, 2020

ConsoleApp21.zip

use above asset. In commandline run dotnet publish -r win-x64. Get error:

C:\Program Files\dotnet\sdk\5.0.100-rc.2.20468.8\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(401,28): error MSB4094: "C:\Users\wul.nuget\packages\microsoft.windows.sdk.net.ref\10.0.19041.1-preview\lib\Microsoft.Windows.SDK.NET.dll;C:\Users\wul.nuget\packages\microsoft.windows.sdk.net.ref\10.0.19041.1-preview\lib\Microsoft.Windows.SDK.NET.dll" is an invalid value for the "CompilationEntry" parameter of the "RunReadyToRunCompiler" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem". [C:\work\temp\ConsoleApp21\ConsoleApp21\ConsoleApp21.csproj]

@mangod9
Copy link
Member

mangod9 commented Sep 28, 2020

@AntonLapounov

@Scottj1s
Copy link
Member

@ujjwalchadha this may not be a CsWinRT issue - William is following up with more investigation

@wli3 wli3 mentioned this issue Sep 29, 2020
5 tasks
@dsplaisted
Copy link
Member

This looks like a bug in the .NET SDK with runtime packs with RuntimePackAlwaysCopyLocal = true, which is only the Microsoft.Windows.SDK.NET.Ref packs.

The _ResolveCopyLocalAssetsForPublish target adds _ResolvedCopyLocalPublishAssets items for assets from runtime packs for self-contained apps:

      <ItemGroup>
        <_ResolvedCopyLocalPublishAssets Include="@(RuntimePackAsset)" Condition="'$(SelfContained)' == 'true'" />
      </ItemGroup>

The _ComputeResolvedCopyLocalPublishAssets target (which depends on _ResolveCopyLocalAssetsForPublish) adds _ResolvedCopyLocalPublishAssets items from runtime packs where RuntimePackAlwaysCopyLocal is true:

      <!-- Include RuntimePackAsset where RuntimePackAlwaysCopyLocal is true -->
      <_ResolvedCopyLocalPublishAssets Include="@(RuntimePackAsset)"
                              Condition="'%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true'">
        <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</DestinationSubPath>
      </_ResolvedCopyLocalPublishAssets>

So for self-contained apps, the items from the Microsoft.Windows.SDK.NET.Ref pack get added twice. We should update the logic to avoid this.

@stevenbrix
Copy link
Contributor

This probably isn't related, but I just came across this issue when publishing with PublishTrimmed set to true

@dplaisted and @wli3, is this a known issue, or just related to windows?

"c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp.sln" (default target) (1:2) ->
"c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp (Package)\WinUICsD
esktopSampleApp (Package).wapproj.metaproj" (default target) (6) ->
"c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp (Package)\WinUICsD
esktopSampleApp (Package).wapproj" (default target) (2:6) ->
"c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSamp
leApp.csproj" (DesktopBridgePublishItemsOutputGroup target) (4:13) ->
(_RunILLink target) ->
ILLink : error IL1018: Missing argument for '--nowarn' option [c:\dev\winui\Samples\WinUICsDesktopSampleApp\Wi
nUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp.csproj]

   "c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp.sln" (default target) (1:2) ->
   "c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp (Package)\WinUICsD
   esktopSampleApp (Package).wapproj.metaproj" (default target) (6) ->
   "c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp (Package)\WinUICsD
   esktopSampleApp (Package).wapproj" (default target) (2:6) ->
   "c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUICsDesktopSamp
   leApp.csproj" (DesktopBridgePublishItemsOutputGroup target) (4:13) ->
   (ILLink target) ->
     C:\Program Files (x86)\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.ta
   rgets(41,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting th
   e PublishTrimmed property to false. [c:\dev\winui\Samples\WinUICsDesktopSampleApp\WinUICsDesktopSampleApp\WinUIC
   sDesktopSampleApp\WinUICsDesktopSampleApp.csproj]

0 Warning(s)
2 Error(s)

Time Elapsed 00:00:37.11

c:\dev\winui>.buildtools\MSBuild\Current\Bin\MSBuild.exe Samples\XamlControlsGallery\XamlControlsGallery.Desktop.sln /p:Platform=x86 /p:Configuration=Debug /restore /m /bl
Microsoft (R) Build Engine version 16.8.0-preview-20452-03+5dee11854 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

c:\dev\winui.buildtools\MSBuild\Current\Bin.buildtools\MSBuild\Current\Bin\MSBuild.exe /bl /m /p:Platform=x86 /p:Configuration=Debug /restore Samples\XamlControlsGallery\XamlControlsGallery.Desktop.sln
Build started 9/30/2020 12:31:48 PM.
1>Project "c:\dev\winui\Samples\XamlControlsGallery\XamlControlsGallery.Desktop.sln" on node 1 (Restore target(s))
.
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|x86".
_GetAllRestoreProjectPathItems:
Determining projects to restore...
Restore:

@AntonLapounov
Copy link
Member

@stevenbrix Please open a separate issue for that and include repro steps.

@ujjwalchadha
Copy link
Contributor

This has been fixed by the latest .net. (net 5.0.100 RTM or greater).

@Scottj1s Scottj1s changed the title CSWrint does not support ready to run CSWinrt does not support ready to run Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pri-0 Blocking/issue has no workaround
Projects
None yet
Development

No branches or pull requests

7 participants