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

Add RestoreProjectStyle --> PackageReference to Android and iOS projects? #181

Closed
dsyme opened this issue Sep 12, 2018 · 7 comments
Closed
Labels
a/samples The issue is regarding the samples a/templates The issue is regarding the templates t/enhancement New feature or request

Comments

@dsyme
Copy link
Collaborator

dsyme commented Sep 12, 2018

I've noticed occasions where dependencies added or updated in the core F# project (SDK-style) don't seem to be copied correctly to the Android and iOS apps (old-style)

I'm not 100% sure why but it looks related to this issue: dotnet/standard#481

The recomendation there is to add

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

I'm not 100% sure but we should probably add this to our Android/iOS app projects

@TimLariviere
Copy link
Member

TimLariviere commented Sep 12, 2018

packages.config is quite annoying when it comes to indirect references.

Switching to hybrid mode is a good idea. (PackageReference in classic project)

Also I'm currently playing with MSBuild.Sdk.Extras which allows to SDK-Style pretty much any framework.
Might be a good solution too.

EDIT: It works well in JetBrains Rider, but cannot be deployed/debugged by VS/VSfM...
So not that great after all.

For example: (removed Configuration|Platform specific attributes to make it easier to read)

<Project Sdk="MSBuild.Sdk.Extras/1.6.55">
  <PropertyGroup>
    <TargetFramework>Xamarin.iOS10</TargetFramework>
  </PropertyGroup>
    
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.FSharp.targets" Condition="Exists('$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.FSharp.targets')" />

  <ItemGroup>
    <Reference Include="System.Numerics" />
    <Reference Include="Xamarin.iOS" />
    <Reference Include="System" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="mscorlib" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Fabulous.Core" Version="0.20.0" />
  </ItemGroup>

  <ItemGroup>
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
    <ImageAsset Include="Assets.xcassets\Contents.json" />
    <InterfaceDefinition Include="LaunchScreen.storyboard" />
    <None Include="Info.plist" />
    <None Include="Entitlements.plist" />
    <InterfaceDefinition Include="Main.storyboard" />
    <Compile Include="ViewController.fs" />
    <Compile Include="AppDelegate.fs" />
    <Compile Include="Main.fs" />
  </ItemGroup>
</Project>

@TimLariviere
Copy link
Member

TimLariviere commented Sep 17, 2018

Migrating to PackageReference would also allow to remove the .nuget folder from the template.
This is only required by msbuild when testing (unnecessary for Visual Studio).

It happened to me several times to have a build failed because I moved files around and forgot to copy the hidden .nuget folder... (explicitly referenced in fsproj)

@dsyme
Copy link
Collaborator Author

dsyme commented Sep 17, 2018

Migrating to PackageReference would also allow to remove the .nuget folder from the template.

That would be great

@TimLariviere
Copy link
Member

TimLariviere commented Sep 19, 2018

RestoreProjectStyle is not supported by fsproj old format. (despite working in csproj)
VS continues to use the packages.config file.

Seems like we're stuck with those issues until Xamarin finally moves to the SDK style: dotnet/fsharp#4152
Android/iOS can't be converted to the new format, and Visual Studio won't have support for RestoreProjectStyle in fsproj

@TimLariviere
Copy link
Member

Based on my discussion with @nosami on Gitter, this limitation seems to apply to VS tooling only.
RestoreProjectStyle should be taken into account by MSBuild.
Will try to migrate the projects.

But if it works, should we also migrate the templates?
Is having better dependency transitivity worth losing the ability to manage the packages through Visual Studio? (for Android/iOS only)

@TimLariviere
Copy link
Member

I migrated successfully a newly created solution from the Fabulous template.
It works like a charm in Visual Studio for Mac, but not in Visual Studio.
So not really usable for now.

Opened an issue on dotnet/fsharp#5849

@dsyme dsyme added the t/enhancement New feature or request label Nov 12, 2018
@TimLariviere TimLariviere added a/samples The issue is regarding the samples a/templates The issue is regarding the templates labels Jun 7, 2019
@TimLariviere
Copy link
Member

Closing the issue for now.
Will migrate to SDK-Style projects when Xamarin.Android and Xamarin.iOS will support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/samples The issue is regarding the samples a/templates The issue is regarding the templates t/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants