Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[WPF] Use project style SDK; target netcoreapp3.0 #7063

Merged
merged 8 commits into from Apr 15, 2020

Conversation

krdmllr
Copy link
Contributor

@krdmllr krdmllr commented Aug 3, 2019

This adds .netcoreapp3.0 besides the existing net 4.6.1 framework target for the WPF backend.

Description of Change

Add target framework .netcoreapp3.0.
Replaces the old Platform.WPF project file with an project sdk style one.
Update the OpenTK.GLControl package to 3.0.1.

Issues Resolved

fixes #5092

API Changes

None

Platforms Affected

WPF

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

  1. Build the project
  2. Test the library with WPF/.NET Core 3
  • Create a WPF/.NET Core 3 app and reference the created dll's
  • Add the logic to init XF and show a XF ContentPage
  • Run the project -> The content page should appear
  1. Test the library with WPF/.NET Framework
  • Create a WPF/.NET Framework app and reference the created dll's
  • Add the logic to init XF and show a XF ContentPage
  • Run the project -> The content page should appear

PR Checklist

  • Has automated tests
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@dnfclas
Copy link

dnfclas commented Aug 3, 2019

CLA assistant check
All CLA requirements met.

@samhouts samhouts added this to In Review in v4.3.0 Aug 4, 2019
@krdmllr krdmllr changed the title Use project style SDK; target netcoreapp3.0 [WPF] Use project style SDK; target netcoreapp3.0 Aug 5, 2019
@jfversluis
Copy link
Member

Hmm build errors, but I'm guessing we need to update the tooling on our side @rmarinho ?

C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(96,5): Error NETSDK1013: The TargetFramework value 'tizen40' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(96,5): Error NETSDK1013: The TargetFramework value 'tizen40' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(96,5): Error NETSDK1013: The TargetFramework value 'tizen40' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
Xamarin.Forms.Platform.WPF\Xamarin.Forms.Platform.WPF.csproj(0,0): Error : C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk.WindowsDesktop\Sdk not found. Check that a recent enough .NET Core SDK is installed and/or increase the version specified in global.json.
Xamarin.Forms.Platform.WPF\Xamarin.Forms.Platform.WPF.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk.WindowsDesktop' specified could not be found.
Xamarin.Forms.Platform.WPF\Xamarin.Forms.Platform.WPF.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk.WindowsDesktop' specified could not be found.
Xamarin.Forms.Platform.WPF\Xamarin.Forms.Platform.WPF.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk.WindowsDesktop' specified could not be found.
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(96,5): Error NETSDK1013: The TargetFramework value 'tizen40' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(96,5): Error NETSDK1013: The TargetFramework value 'tizen40' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
Process 'msbuild.exe' exited with code '1'.

@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 6, 2019

C:\Program Files\dotnet\sdk\2.2.105

Looks like you are not building with .net core 3? I used the latest preview (7) and enabled preview support in VS 2019.

@samhouts samhouts added the p/WPF label Aug 6, 2019
@rmarinho
Copy link
Member

rmarinho commented Aug 8, 2019

@krdmllr this would need to install net core 3.0 preview on the bits, not sure if you are familiar with AzurePipelines but basically we need in the windows bits to use the botnet installer task to install .net core 3, and then try the build, you can edit our yaml file to do that.

@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 8, 2019

@rmarinho i'm familiar with azure pipelines :)
In this yaml: https://github.com/xamarin/Xamarin.Forms/blob/master/build/steps/build-windows.yml ?

I would add the following task

- task: UseDotNet@2
  displayName: 'Install .NET Core 3 preview sdk'
  inputs:
    packageType: sdk
    version: 3.0.100-preview7-012821
    installationPath: $(Agent.ToolsDirectory)/dotnet

@rmarinho
Copy link
Member

rmarinho commented Aug 8, 2019

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 9, 2019

Can you see if the install .net core 3 task is successful?

We could create a global.json in the solution root directory during the build where we can set the .net core version https://docs.microsoft.com/de-de/dotnet/core/tools/global-json

dotnet new globaljson --sdk-version 3.0.100-preview7-012821

@samhouts samhouts moved this from In Review to In Progress in v4.3.0 Aug 12, 2019
@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 13, 2019

The build is currently failing because the installed VS/MSbuild version is too old for dotnetcore 3
.NET Core SDK requires at least version 16.0.0 of MSBuild. The current available version of MSBuild is 15.9.21.664.
Could you change the agent to a VS2019 one?

@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 14, 2019

Besides the build pipelin issues I currently have the issue that the OpenTK lib does not target .net standard. Their update is on the way but I think it will take some time opentk/opentk#823

Since this only affects the OpenGLViewRenderer, I excluded the file and dependency when building for .net core 3 so this version currently does not support the OpenGLView. The .net461 version is unaffected.

@jfversluis
Copy link
Member

I've been working with @krdmllr to get the build working. For now I have been manually triggering builds for the YAML file and we've made some progress. The one thing that seems to stop us now is that there is no Java SDK installed on the hosted Win2019/VS2019 agents.

@jfversluis
Copy link
Member

Just revisiting this one. @rmarinho can we simply switch to VS2019 build agents? Is that planned already somewhere?

@rmarinho
Copy link
Member

Last time i checked the vs2019 wasn't building our UWP projects out of the box

@krdmllr
Copy link
Contributor Author

krdmllr commented Aug 26, 2019

@rmarinho is there anything planned on your site to migrate to VS2019 build servers?

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

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

Tried to run the gallery app, but it becomes unresponsive immediately with a black screen

image

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

Tested on two different machines (one of them is a Windows Virtual Machine) but, I see the same black screen on both cases.
Captura de pantalla 2020-03-26 a las 8 54 06

We have to investigate what happens here, test with different .NET Core versions, etc.

@trturino
Copy link

trturino commented Apr 1, 2020

The pages Gallery project is showing a black screen even if you build using .NET Framework
image

@trturino
Copy link

trturino commented Apr 5, 2020

I just got the master branch and reapplied all changes that this branch has and the Gallery project start working again. At least on .NET Framework.
Maybe a rebase solve the problem.

I was running some additional tests, and have you realized that OpenTK is built only for .NET Framework? An 4.0 version is being developed with support of .Net Standard/Core.
But so far there is no OpenTK.GLControl for .NET Core / Standard

@krdmllr
Copy link
Contributor Author

krdmllr commented Apr 11, 2020

Finally fixed it, the generics.xaml wasnt loading because this got kicked out while merging [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
@PureWeen can you verify that everything works now :)? Thanks everyone for testing!

@trturino the OpenGL was discussed above (feb 22)

@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Apr 14, 2020
@rmarinho rmarinho merged commit 37abca9 into xamarin:master Apr 15, 2020
vCurrent (4.8.0) automation moved this from In Progress to Done Apr 15, 2020
@VladislavAntonyuk
Copy link
Contributor

What about other projects? Maps, Control Gallery? they should also be update to restore with netcoreapp

@rmarinho
Copy link
Member

@VladislavAntonyuk PR's are welcome :) Some stuff like iOS and Android don't support sdk style projects right now irc.

@samhouts samhouts added this to Done in Sprint 169 Apr 30, 2020
@maxim-saplin
Copy link

I have build errors with blank WPF Core app and 4.8.0.780-nightly XF build. Should I add Xamarin.Forms package reference to the project and right away there're errors:

1>App.xaml : error : Value cannot be null.
1>App.xaml : error : Parameter name: key
1>MainWindow.xaml : error : Value cannot be null.
1>MainWindow.xaml : error : Parameter name: key

@VladislavAntonyuk
Copy link
Contributor

@maxim-saplin , it is my favorite issue) Add <EmbeddedResource Remove="**\*.xaml" /> in your csproj

@maxim-saplin
Copy link

@VladislavAntonyuk that worked, thanks!

@MagicAndre1981
Copy link
Contributor

@krdmllr

can you check this issue, please? During your csproj style change the application info data are lost, now version is 0.0.0.0

version is empty

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/buildchain approved Has two approvals, no pending reviews, and no changes requested p/WPF
Projects
No open projects
4.7.0
  
Done
Sprint 169
  
Done
Development

Successfully merging this pull request may close these issues.

WPF restore with .net core 3