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

.NET Maui "Single Project" #13858

Merged
merged 1 commit into from Feb 26, 2021

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Feb 24, 2021

Description of Change

Context: https://github.com/xamarin/xamarin-android/blob/fcd9c30164d4ac0e88440357b5c96b9fdebccb39/Documentation/guides/OneDotNetSingleProject.md

We are aiming to get a new project type working that would have a
.csproj such as:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0-android;net6.0-ios</TargetFramework>
    <OutputType>Exe</OutputType>
    <SingleProject>true</SingleProject>
  </PropertyGroup>
</Project>

Within the project you would have:

  • *.cs all shared code
  • iOS/* - iOS only stuff, including Info.plist
  • Android/* - Android only stuff, including AndroidManifest.xml

I also used some other new settings that results in a smaller
Info.plist and AndroidManifest.xml:

<ApplicationTitle>Single Project</ApplicationTitle>
<ApplicationId>com.microsoft.maui.singleproject</ApplicationId>
<ApplicationVersion>1.0</ApplicationVersion>
<AndroidVersionCode>1</AndroidVersionCode>

The eventual goal being we might be able to completely get rid of
Info.plist and AndroidManifest.xml for simple apps. You would only
need them for edge-case, platform-specific features.

To get this working within a NuGet package, we can include two new
files:

  • Xamarin.Forms.SingleProject.props
  • Xamarin.Forms.SingleProject.targets

They only enable things conditionally, if $(SingleProject) is set.

I created a new sample with a single Label to demonstrate things
working.

API Changes

None

Platforms Affected

  • Core/MSBuild (all platforms)

Behavioral/Visual Changes

A new $(SingleProject) MSBuild property will opt you into a new, magical project type.

Before/After Screenshots

Not applicable

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@PureWeen PureWeen added this to Needs Review in .NET MAUI (P2) via automation Feb 25, 2021
@jonathanpeppers jonathanpeppers force-pushed the maui-singleproject branch 2 times, most recently from 1f5defb to 7334d29 Compare February 26, 2021 14:07
Context: https://github.com/xamarin/xamarin-android/blob/fcd9c30164d4ac0e88440357b5c96b9fdebccb39/Documentation/guides/OneDotNetSingleProject.md

We are aiming to get a new project type working that would have a
`.csproj` such as:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net6.0-android;net6.0-ios</TargetFramework>
        <OutputType>Exe</OutputType>
        <SingleProject>true</SingleProject>
      </PropertyGroup>
    </Project>

Within the project you would have:

* `*.cs` all shared code
* `iOS/*` - iOS only stuff, including `Info.plist`
* `Android/*` - Android only stuff, including `AndroidManifest.xml`

I also used some other new settings that results in a smaller
`Info.plist` and `AndroidManifest.xml`:

    <ApplicationTitle>Single Project</ApplicationTitle>
    <ApplicationId>com.microsoft.maui.singleproject</ApplicationId>
    <ApplicationVersion>1.0</ApplicationVersion>
    <AndroidVersionCode>1</AndroidVersionCode>

The eventual goal being we might be able to completely get rid of
`Info.plist` and `AndroidManifest.xml` for simple apps. You would only
need them for edge-case, platform-specific features.

To get this working within a NuGet package, we can include two new
files:

* `Xamarin.Forms.SingleProject.props`
* `Xamarin.Forms.SingleProject.targets`

They only enable things conditionally, if `$(SingleProject)` is set.

I created a new sample with a single `Label` to demonstrate things
working.
@PureWeen PureWeen merged commit 0e94f14 into xamarin:main-handler Feb 26, 2021
2 checks passed
.NET MAUI (P2) automation moved this from Needs Review to Done Feb 26, 2021
@jonathanpeppers jonathanpeppers deleted the maui-singleproject branch February 26, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants