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

Fix building of csproj samples directly #1168

Merged
merged 3 commits into from
Jun 4, 2021
Merged

Fix building of csproj samples directly #1168

merged 3 commits into from
Jun 4, 2021

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented Jun 3, 2021

Description of Change

  • Add CI step that builds singleproject.csproj and the two net6 sample projects to make sure they don't break
  • updated readme with some workarounds related to Android simulator
  • Added cake targets for building and deploying android/ios samples
  • "SAMPLE-ANDROID"
  • "Sample-IOS"

@PureWeen PureWeen requested a review from Eilon June 3, 2021 16:53
Copy link
Member

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on my machine! I followed the standard steps and Android launches in the emulator! I'll try Mac next but this is already huge!

@Eilon
Copy link
Member

Eilon commented Jun 3, 2021

For iOS I ran:

./bin/dotnet/dotnet build src/Controls/samples/Controls.Sample.iOS/Maui.Controls.Sample.iOS-net6.csproj -t:Run

And got this error:

  Failed to launch the simulator: Could not find file "/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.iOS/bin/Debug/net6.0-ios/iossimulator-x64/Maui.Controls.Sample.iOS.app/Maui.Controls.Sample.iOS"
EXEC : error MT1008: Failed to launch the simulator: Could not find file "/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.iOS/bin/Debug/net6.0-ios/iossimulator-x64/Maui.Controls.Sample.iOS.app/Maui.Controls.Sample.iOS" [/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.iOS/Maui.Controls.Sample.iOS-net6.csproj]
          
/Users/eilonlipton/GitHub/maui/bin/dotnet/sdk/6.0.100-preview.5.21275.1/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(852,5): error MSB3073: The command "/Users/eilonlipton/GitHub/maui/bin/dotnet/packs/Microsoft.iOS.Sdk/14.5.100-preview.5.884/tools/bin/mlaunch --launchsim bin/Debug/net6.0-ios/iossimulator-x64/Maui.Controls.Sample.iOS.app/ --device ":v2:runtime=com.apple.CoreSimulator.SimRuntime.iOS-14-5,devicetype=com.apple.CoreSimulator.SimDeviceType.iPad-Pro-12-9-inch-5th-generation" --stdout /dev/ttys000 --stderr /dev/ttys000 --wait-for-exit" exited with code 1. [/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.iOS/Maui.Controls.Sample.iOS-net6.csproj]

And for MacCatalyst I ran:

./bin/dotnet/dotnet build src/Controls/samples/Controls.Sample.MacCatalyst/Maui.Controls.Sample.MacCatalyst-net6.csproj -t:Run

And got this error:

nction=_LSOpenStuffCallLocal}
/Users/eilonlipton/GitHub/maui/bin/dotnet/sdk/6.0.100-preview.5.21275.1/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(852,5): error MSB3073: The command "open bin/Debug/net6.0-maccatalyst/maccatalyst-x64//Maui.Controls.Sample.MacCatalyst.app" exited with code 1. [/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.MacCatalyst/Maui.Controls.Sample.MacCatalyst-net6.csproj]

And I tried another command line to launch MacCatalyst:

dotnet build src/Controls/samples/Controls.Sample.MacCatalyst/Maui.Controls.Sample.MacCatalyst-net6.csproj -t:Run -p:Configuration=Debug -p:TargetFramework=net6.0-maccatalyst --no-restore

And got the same error:

  The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=3665, _LSFunction=_LSOpenStuffCallLocal}
/usr/local/share/dotnet/sdk/6.0.100-preview.4.21255.9/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(881,5): error MSB3073: The command "open bin/Debug/net6.0-maccatalyst/maccatalyst-x64//Maui.Controls.Sample.MacCatalyst.app" exited with code 1. [/Users/eilonlipton/GitHub/maui/src/Controls/samples/Controls.Sample.MacCatalyst/Maui.Controls.Sample.MacCatalyst-net6.csproj]

Is there a different command line I should use for iOS and MacCatalyst?

@PureWeen
Copy link
Member Author

PureWeen commented Jun 3, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen
Copy link
Member Author

PureWeen commented Jun 3, 2021

@Eilon I'm not sure on those exceptions. I'm seeing the same thing

@jonathanpeppers @Redth @mattleibow ?

@Redth
Copy link
Member

Redth commented Jun 3, 2021

Unfortunately these are intermittent it seems on catalyst. @dalexsoto any insights yet into these?

Comment on lines +342 to 346
& $(DotNet.Path) build src/Controls/samples/Controls.Sample.Droid/Maui.Controls.Sample.Droid-net6.csproj -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-android.binlog
& $(DotNet.Path) build src/Controls/samples/Controls.Sample.iOS/Maui.Controls.Sample.iOS-net6.csproj -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-iOS.binlog
& $(DotNet.Path) build src/Controls/samples/Controls.Sample.MacCatalyst/Maui.Controls.Sample.MacCatalyst-net6.csproj -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-MacCatalyst.binlog
& $(DotNet.Path) build src/Controls/samples/Controls.Sample.SingleProject/Maui.Controls.Sample.SingleProject.csproj -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-SingleProject.binlog
& $(DotNet.Path) build Microsoft.Maui-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration).binlog
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These projects are all in Microsoft.Maui-net6.sln, so they are already getting built. We shouldn't need to build them twice?

Copy link
Member Author

@PureWeen PureWeen Jun 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason to build them is to verify that they are able to build not via the SLN file

For example right now on our main branch if you run
dotnet build any_of_these_projects.csproj

it fails.

So the purpose of adding all of these is to make sure that they stay working and that new PRs don't break them

<BuildForWinUI Condition="'$(SolutionFileName)' == 'Microsoft.Maui.WinUI.sln' AND '$(Packing)' == ''">true</BuildForWinUI>
<BuildForAndroid Condition="'$(SolutionFileName)' == 'Microsoft.Maui.Droid.sln' AND '$(Packing)' == ''">true</BuildForAndroid>
<BuildForNet6 Condition="'$(Packing)' == 'true' OR $(SolutionFileName.Contains('net6')) == true OR '$(BuildForWinUI)' == 'true' OR '$(BuildForAndroid)' == 'true'">true</BuildForNet6>
<BuildForNet6 Condition="'$(Packing)' == 'true' OR $(MSBuildProjectFile.Contains('SingleProject')) == true OR $(MSBuildProjectFile.Contains('net6')) == true OR $(SolutionFileName.Contains('net6')) == true OR '$(BuildForWinUI)' == 'true' OR '$(BuildForAndroid)' == 'true'">true</BuildForNet6>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Condition is starting to get out of hand, can we invert the condition here so it will be a lot shorter? Check for the legacy Xamarin .sln or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but since it's a weird hack either way I'd rather not mess with it. I'll probably do it wrong a few times while trying to invert it :-) Ideally we can just delete this whole thing in a few weeks and all of our legacy slns?!?

@PureWeen PureWeen requested a review from jonathanpeppers June 4, 2021 01:13
@PureWeen PureWeen merged commit 2e71365 into main Jun 4, 2021
@PureWeen PureWeen deleted the fix_proj_builds branch June 4, 2021 03:37
@PureWeen
Copy link
Member Author

PureWeen commented Jun 4, 2021

I merged this one for now so we can at least fix the builds

I created an issue here for @Eilon 's comments

#1175

If anyone has any insights why ios and maccatalyst aren't launching

@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2023
@samhouts samhouts added the fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants