Skip to content

Commit

Permalink
added project files resulting in Error CS5001 Program does not contai…
Browse files Browse the repository at this point in the history
…n a static 'Main' method suitable for an entry point MauiTestApp (net8.0-windows10.0.19041.0)
  • Loading branch information
Musicnotes committed Apr 22, 2024
1 parent 9e556ac commit da06efe
Show file tree
Hide file tree
Showing 41 changed files with 1,216 additions and 0 deletions.
35 changes: 35 additions & 0 deletions MauiTestApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiTestApp", "MauiTestApp\MauiTestApp.csproj", "{AFC3E31E-188C-4E17-AD11-7C72276DF500}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|x64.ActiveCfg = Debug|x64
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|x64.Build.0 = Debug|x64
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Debug|x64.Deploy.0 = Debug|x64
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|Any CPU.Build.0 = Release|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|Any CPU.Deploy.0 = Release|Any CPU
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|x64.ActiveCfg = Release|x64
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|x64.Build.0 = Release|x64
{AFC3E31E-188C-4E17-AD11-7C72276DF500}.Release|x64.Deploy.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {85942227-D28F-47B7-A525-A78E2CAA2E16}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions MauiTestApp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiTestApp"
x:Class="MauiTestApp.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions MauiTestApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace MauiTestApp
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
15 changes: 15 additions & 0 deletions MauiTestApp/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MauiTestApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiTestApp"
Shell.FlyoutBehavior="Disabled"
Title="MauiTestApp">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
10 changes: 10 additions & 0 deletions MauiTestApp/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace MauiTestApp
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
6 changes: 6 additions & 0 deletions MauiTestApp/Code/CustomPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiTestApp.Code.CustomPage"
Title="CustomPage">
</ContentPage>
9 changes: 9 additions & 0 deletions MauiTestApp/Code/CustomPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace MauiTestApp.Code;

public partial class CustomPage : ContentPage
{
public CustomPage()
{
InitializeComponent();
}
}
37 changes: 37 additions & 0 deletions MauiTestApp/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiTestApp.MainPage">

<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />

<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />

<Label
Text="Welcome to &#10;.NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

<Button
x:Name="CounterBtn"
Text="Click me!"
SemanticProperties.Hint="Counts the number of times you clicked"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />

</VerticalStackLayout>
</ScrollView>

</ContentPage>
27 changes: 27 additions & 0 deletions MauiTestApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using MauiTestApp.Code;

namespace MauiTestApp
{
public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
{
count++;

if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";

Navigation.PushAsync(new CustomPage());
}
}

}
35 changes: 35 additions & 0 deletions MauiTestApp/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using MauiTestApp.Code;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Compatibility.Hosting;
using Musicnotes.Forms.UWP.Code.CustomRenderers.Buttons;

namespace MauiTestApp
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.UseMauiCompatibility()
.ConfigureMauiHandlers((handlers) =>
{
handlers.AddHandler(typeof(CustomPage), typeof(CustomPageRenderer));
})
;


#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
}
}
103 changes: 103 additions & 0 deletions MauiTestApp/MauiTestApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>MauiTestApp</RootNamespace>

<UseMaui>true</UseMaui>
<MauiVersion>8.0.14</MauiVersion>

<UseWinUI>true</UseWinUI>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDefaultMauiItems>false</EnableDefaultMauiItems>

<!-- Display name -->
<ApplicationTitle>MauiTestApp</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.mauitestapp</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<Platforms>AnyCPU;x64</Platforms>
<DefaultLanguage>en-us</DefaultLanguage>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />

</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<None Remove="Code\**\*.xaml" />
<None Remove="Platforms\Windows\Code\**\*.xaml" />
<None Remove="App.xaml" />
<None Remove="AppShell.xaml" />
<None Remove="MainPage.xaml" />
<None Remove="Platforms\Windows\App.xaml" />

<MauiXaml Include="Code\**\*.xaml" />
<MauiXaml Include="Resources\**\*.xaml" />

<MauiXaml Include="App.xaml" />
<MauiXaml Include="AppShell.xaml" />
<MauiXaml Include="MainPage.xaml" />

<Page Include="Platforms\Windows\Code\**\*.xaml" />
<AppxManifest Include="Platforms\Windows\Package.appxmanifest" />

<Page Update="Platforms\Windows\App.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

</ItemGroup>

<ItemGroup>
<MauiXaml Update="Code\CustomPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions MauiTestApp/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions MauiTestApp/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace MauiTestApp
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
16 changes: 16 additions & 0 deletions MauiTestApp/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace MauiTestApp
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
6 changes: 6 additions & 0 deletions MauiTestApp/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
10 changes: 10 additions & 0 deletions MauiTestApp/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace MauiTestApp
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
14 changes: 14 additions & 0 deletions MauiTestApp/Platforms/MacCatalyst/Entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

Loading

0 comments on commit da06efe

Please sign in to comment.