Forum Discussion
.NET MAUI WPF template not working
Hello.
I had a problem with MAUI templates disappearing. It is not the first time it happens.
I tried reinstalling several times even using the `InstallCleanup` utility from within VS Installer folder.
Then I reinstalled VS Community 2022 and VS Community 2022 Preview. All the MAUI related features are checked yet I had no template.
After following the instructions on [this page](https://github.com/dotnet/maui/issues/1473) I got templates (TLDR: I typed `dotnet new --install Microsoft.Maui.Templates` as suggested). 1st time I had only Blazor template and another displaying but after a further restart of VS they seem to appear all.
So at this point templates seem to be present.
When I create a new project I am told there are errors:
NU1012
NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst
In solution explorer they seem to be present but Windows framework does not work.
There are updates available but it won't install.
NETSDK1147
Another error is
NETSDK1147 To build this project, the following workloads must be installed: maui-android
To install these workloads, run the following command: dotnet workload install maui-android
Typing the command does not work neither
dotnet workload install maui-android
Failed to update the advertising manifest microsoft.net.sdk.macos: microsoft.net.sdk.macos.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.sdk.ios: microsoft.net.sdk.ios.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.sdk.tvos: microsoft.net.sdk.tvos.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: microsoft.net.sdk.maccatalyst.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.workload.emscripten: microsoft.net.workload.emscripten.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.sdk.android: microsoft.net.sdk.android.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: microsoft.net.workload.mono.toolchain.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Failed to update the advertising manifest microsoft.net.sdk.maui: microsoft.net.sdk.maui.manifest-6.0.300 is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.300-rc.1.5208)
Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.300-rc.1.5208)
Workload installation failed. Rolling back installed packs...
Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.300-rc.1.5208)
Installation rollback failed: One or more errors occurred. (microsoft.maui.core.ref.android.msi.x64::6.0.300-rc.1.5208 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\".)
Workload installation failed: One or more errors occurred. (microsoft.maui.core.ref.android.msi.x64::6.0.300-rc.1.5208 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\".)
Description:
Install one or more workloads.
Usage:
dotnet workload install [<WORKLOAD_ID>...] [options]
Arguments:
<WORKLOAD_ID> The NuGet package ID of the workload to install.
Options:
--configfile <FILE> The NuGet configuration file to use.
-s, --source <SOURCE> The NuGet package source to use during the restore. To specify multiple sources, repeat the option.
--skip-manifest-update Skip updating the workload manifests.
--include-previews Allow prerelease workload manifests.
--temp-dir <temp-dir> Specify a temporary directory for this command to download and extract NuGet packages (must be secure).
--disable-parallel Prevent restoring multiple projects in parallel.
--ignore-failed-sources Treat package source failures as warnings.
--no-cache Do not cache packages and http requests.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
-v, --verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
-?, -h, --help Show command line help.
CS0103, CS0246 and XLS0414
Ultimately the source code is full of these errors
CS0103 The name 'InitializeComponent' does not exist in the current context MauiApp1 (net6.0-android), MauiApp1 (net6.0-ios), MauiApp1 (net6.0-maccatalyst)
CS0246 The type or namespace name 'ContentPage' could not be found (are you missing a using directive or an assembly reference?) MauiApp1 (net6.0-android), MauiApp1 (net6.0-ios), MauiApp1 (net6.0-maccatalyst)
XLS0414 The type 'ContentPage' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built
I was experimenting with MAUI on a previous version. I know all these features are still under development. Referring to the 1st link I provide this issue already was and presumably an update fixed it yet the problem still exist.
Any clue what I should do to make it work ?
Best regards.
- JamesMontemagnoMicrosoftI would try the latest preview for RC to see if they are there now.