The type or namespace name 'Telerik' could not be found

1 Answer 170 Views
General Discussions
Kenneth
Top achievements
Rank 1
Kenneth asked on 11 Sep 2023, 06:59 PM

I simply installed the controls, created a new VS2022 project using the installed Project Template for the Configurable Wizard, then selected Blank Shell.

I can not run the sample app due to this error in the MauiProgram using statement.

using Telerik.Maui.Controls.Compatibility;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

namespace TelerikMauiApp1
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseTelerik()
                .UseMauiApp<App>()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                    fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
                });

            return builder.Build();
        }
    }
}


1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 11 Sep 2023, 07:45 PM

Hi Kenneth,

That error just means that the app didn't get to finish compiling, please check your errors pane for the underlying cause. Since you mentioned that you use the project wizard, I believe I know your issue. take the following steps:

  1. Open App.xaml and delete the 3rd ResourceDictionary line (the one that points to TelerikStyles.xaml)
  2. Expand the project's Resources/Styles folder and delete TelerikStyles.xaml file.
  3. Rebuild (not just a Build) the project

The reason for this problem is due to changes in .NET MAUI that doesn't allow you to define external types until the Maui App is instantiated. So the RadButton style inside the TelerikStyles.xaml file causes the issue. This is resolved after deleting the file (you can place any RadButton styles after App.xaml is loaded).

 

Side Note: There's another possibility, where you have not yet added the Telerik NuGet server as a package source to Visual Studio. Please follow these instructions => Started Guide for Installing with Telerik NuGet Server and VS. (if you're using a macOS, see this instead).

Regards,
Lance | Manager Technical Support
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com
Kenneth
Top achievements
Rank 1
commented on 11 Sep 2023, 08:21 PM

I do think it has to do with NuGet but not sure.  I attached a screen shot.  When I look at the Installed packages for the Solution, there are no Telerik packages listed however.  When I try and browse (on the solution manager), it just spins.  The other suggestion I tried but did not do anything.

 

 

Lance | Senior Manager Technical Support
Telerik team
commented on 11 Sep 2023, 08:50 PM

That means you do already have the package source setup. When you first tried to build/restore a project that connects to our server, you would have been prompted for credentials (if you checked the "save credentials" checkbox, then those got saved in the Windows Credential Manager app for future use).

If you're concerned about the connection, try just creating a new Microsoft "blank .NET MAUI project" instead, there's only 2 steps needed to add Telerik support:

  1. Then install Telerik.UI.for.Maui.Trial package to the project
  2. Go to MauiProgram.cs and add the UseTelerik() line (as seen in the previously linked docs)

Done! Now you can follow any control's "getting started" documentation, or drag/drop a control from the Telerik Maui Toolbox.

Kenneth
Top achievements
Rank 1
commented on 11 Sep 2023, 10:25 PM

There is something wrong with my NuGet setup.  I am getting this error when trying to browse the packages tied to https://nuget.telerik.com/v3/index.json. See the error below:


Error [Telerik NuGet] Unable to load the service index for source https://nuget.telerik.com/v3/index.json.
  Response status code does not indicate success: 401 (Unauthorized).

Kenneth
Top achievements
Rank 1
commented on 11 Sep 2023, 10:26 PM

Could it be  because this is a trial??
Didi
Telerik team
commented on 12 Sep 2023, 07:37 AM

Hi Kenneth,

It seems you have entered wrong credentials for the NuGet package, as the error is 401 (Unauthorized).

Steps you need to follow:

1. Remove the Telerik NuGet from Visual Studio. 

2. Clear NuGet cache and close Visual Studio

3. Open windows credential manager - > windows credentials and delete all credentials related to Telerik NuGet

4. Open Visual Studio and setup the Telerik NuGet server, then install the Telerik MAUI package, window for entering the credentials will be displayed. 

5. Enter the credentials you use for your Telerik account.

Also login to the Telerik account and check what are the available packages for download. 

Hope these steps will be of help.

 

Tags
General Discussions
Asked by
Kenneth
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or