-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet cli passing -target:Restore to MSBuild instead of -restore #15485
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@sfoslund Can you take a look? |
@jonathanpeppers can you give some more information on how to repro this? The binlogs you provided are on two different platforms, does this only repro on windows or mac? |
@sfoslund I think it happens on all platforms. My Mac has the older 6.0.100-alpha.1.20562.2 installed, so that is where I could grab the working You can compare https://github.com/xamarin/net6-samples vs the branch on my PR: There are installation instructions on the |
Okay I think I understand this issue now but I want to verify my understanding of the history with @dsplaisted. The basic issue is with RestoringCommand, which has logic to decide if we can restore with It looks like before the System.CommandLine change there was a bug and we were using So theoretically I think switching to system.commandline "fixed" this bug in that now we try to use a separate restore command when the target framework is specified on the command line. However, this has created a bug here such that we pass the @dsplaisted does this make sense to you? Do you know of any changes in the |
After discussing with @dsplaisted, we do want the @jonathanpeppers is there a reason you need to specify the run target while building? |
I still get this error with
I also tried adding These commands both work for me:
|
Yes, I'm seeing that error with 6.0.100-alpha.1.20562.2 (the version you're currently using which doesn't have the system.commandLine change). It's odd because in the binlog I can see the run target from Microsoft.NET.Sdk.targets is being imported and overriding the MSBuild target. I'm not able to repro this issue with simpler projects, do you have any custom logic for running? |
I just updated to One thing, is we completely replace the We also set Maybe we need to specify the arguments here in a better way? If I comment out where we set
|
Huh, it seems like something with the MSBuild logic then. In the binlog I'm seeing that file imported and |
Ah, it sounds like the reordering of the workload targets (from #14393) impacted this then. Targets that need to override targets from the .NET SDK should be refactored into a separate .targets file, which should be added to the <PropertyGroup Condition=" '$(ImportWindowsDesktopTargets)' == 'true'">
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)../../Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets</AfterMicrosoftNETSdkTargets>
</PropertyGroup> |
@dsplaisted I think we're already using Looking at the logs, I think it is imported at the right time, it's nearly last: |
It seems like Sarah was correct here. Fixing one bug (It sounds like |
@sfoslund Could you work on fixing this? I tried, but ran into issues where an argument such as Here is the change I made, which added some test coverage and tried to fix |
|
As seen in: dotnet/maui-samples#52
We have a multi-targeted project with:
To deploy to an Android device/emulator (and not iOS), you can run:
> dotnet build -t:Run -p:TargetFramework=net6.0-android
With .NET 6.0.100-alpha.1.21064.27, this command fails with:
The MSBuild arguments the dotnet cli is passing seem odd:
With .NET 6.0.100-alpha.1.20562.2, it used to pass:
In fact, you can workaround the problem by doing:
> dotnet build -t:Run -p:TargetFramework=net6.0-android --no-restore
I tried creating other, simpler projects to reproduce this issue, but a console app with
TargetFrameworks=net5.0;net6.0
works fine. I always see-restore
being passed.I think it is something to with .NET workloads and multi-targeting at the same time?
The text was updated successfully, but these errors were encountered: