Dependencies in a solution with project references

Hi ,
Is it not possible to have a project dependency reference when using a Radzen studio app to convert to Radzen Blazor Studio ?

image

The app will not build producing CS0246 errors , "are you missing a using directive .. " .

Did I miss something ?

Regards,
Mehmet

Yes, it’s possible. In fact anything that can be compiled using dotnet run will work since this is we are using.

@enchev
The Solution runs and compiles fine under VS 2022 or runs ok when in Radzen Studio .
But does not in Radzen Blazor Studio .

image
I also see one project loaded in Blazor Studio .

What happens if you try to run with dotnet run?

With dotnet run "projectname" it runs the application :
I have multi tenancy so I see multiple :

Now listening on: https://localhost:5000
Now listening on: https://localhost:5001 etc..

Running on both ports is not related to multi tenancy.

I have multi tenancy and also configured multiple ports , but the app runs on all configured ports with dotnet run.

The app also runs when I use the blue " run " or "debug" button on the top right of Radzen Blazor Studio ..

The CS0246 error I see when I want to edit a page :
clicking on a page does not make it visual editable but displays :
image

And in the Output i see:

Going to the line in the code:

I have this in the using section :
image

So conclusion is that the app will run using dotnet run or the run button within Blazor Studio , but it fails to edit any pages visually ..

Project references are supported. There is some other problem with your app but we can't tell what from a screenshot.

Thank you!
I will try to investigate more, it is strange that it runs the app without complaining from within Blazor Studio but can not build any pages

only thing I can think of is that the directory of the referenced project is one level above the folder where the solution file resides ;

<ItemGroup>
<ProjectReference Include="..\..\pain00100103\pain00100103.csproj" />

I cannot debug Blazor Studio, but I have removed the project reference and referenced the DLL directly. This resolves the issue, but it does not give any closure on why a project reference to ".NET Standard 2.0 targeted" is not accepted to build the app to visually be able to edit the page.
The source code for the referenced project was auto-generated by xsd tool.

The next issue arises now that I have eliminated the prior issue.

I have a string extension in my "project.Pages" namespace like this:

public static class StringExt
{
    public static string Truncate(this string value, int maxLength, string truncationSuffix = "…")
    {
        return value?.Length > maxLength
            ? value.Substring(0, maxLength) + truncationSuffix
            : value;
    }
}

Blazor Studio now complains "The page cannot render" and logs:

error CS0121:
The call is ambiguous between the following methods or properties:
'projectName.Pages.StringExt.Truncate(string, int, string)'
and
'projectName.Pages.StringExt.Truncate(string, int, string)'

Searched the app for this , but no duplicate methods found .

Yet the app runs fine and works when run from Visual Studio and Blazor Studio.

So it is something in the rendering of the pages and the visual editing part where Blazor Studio has some issues in this kind of situation?

I'm just trying again to see if my app can be transferred to Blazor Studio, so there is no blocking issue for me. Just sharing the experience.

Hi Radzen Team,

I’ve installed the latest app build today (with .NET Core 9.0 support), but I’m still encountering the same issues.

I’d like to transition to the new Blazor Studio, but moving from Radzen Studio hasn’t been as smooth as I’d hoped. Despite several attempts, I’ve had no success running a real live app developed in Radzen Studio.

Do you have any additional tips or guidance? Does it make any difference if the app is on .Net 7.0 ?

Best regards,
Mehmet

Note: Even the "using Radzen" statement gets flagged as an error. However, "Run" executes the application without any issues. The problem lies specifically in editing the app with Radzen Blazor Studio.


No, we don't have additional tips. We need to reproduce the problem with your project.

@korchev
I’d like to clarify and provide more details to confirm that this issue specifically involves project references in RBS:

What I Did

  1. Created a new application in RBS.
  2. Scaffolding CRUD pages using the built-in tools.
  3. Opened the generated solution in Visual Studio.
  4. Added a project reference to another project to the solution.
  5. Opened the solution again in RBS and added a using statement for the project reference in a .razor.cs file.

Observed Behavior

  • The application builds and runs correctly via dotnet run and using the blue "Run" button in RBS.
  • However, RBS fails to render the page in the designer, displaying:

"Application does not build. There is a build error which prevents this page from rendering."
The output window specifically shows:
"The referenced "Pain" could not be found (are you missing a using directive or an assembly?)"

This issue can be reproduced following the steps above. It appears that while project references are supported at runtime, they are not correctly recognized by RBS during the build step needed for page rendering.

Can you confirm if this is a known limitation, or if there’s an additional configuration required to make project references work in RBS?

Some additional info below.

The part in .csproj file

  <ItemGroup>
    <ProjectReference Include="..\pain00100103\pain00100103.csproj" />
  </ItemGroup>

The part in .sln file

Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pain00100103", "..\pain00100103\pain00100103.csproj", "{2BE5F8F9-9C86-4393-B596-DE8766117E38}"
EndProject

The part in .razor.cs file

using Radzen.Blazor;
using Pain;
namespace testApp.Components.Pages
{
  public partial class test
  {

However when including a referenfdce to the assembly directly and removing the project reference RBS can render the page.

Reference to dll in .csproj file

  <ItemGroup>
    <Reference Include="pain00100103">
      <HintPath>..\..\pain00100103\bin\Release\netstandard2.0\pain00100103.dll</HintPath>
    </Reference>
  </ItemGroup>

This is not a known limitation. In fact every WASM application created by RBS uses a project reference.

Thank you for the reply,
the problem is reproducible with just a few simple steps, did you try ?

I did try and couldn't reproduce it. The problem seems to be relate to your particular setup and this is why I am asking for the actual files to test it. If you can't provide them we won't be able to assist any further.

I see, I’ve sent you the files of my test case for review.

thank you in advance!
Mehmet

The problem is the target framework of the referenced project - netstandard2.0. Changing it to a supported version e.g. net8.0 solves the problem and the app opens as expected.

Thank you for the clarification!
So, to confirm, the limitation is that for RBS to render the app correctly, all referenced project dependencies must have the same target framework?

It seems this isn’t a requirement when using Visual Studio or running the app with "dotnet run". That was my confusion I think.

Thank you for investigating!

Radzen Blazor Studio doesn't support older .NET framework versions. Thus it ignores this project and does not build it in design time.