excubo-ag / Blazor.Diagrams

https://excubo-ag.github.io/Blazor.Diagrams/
MIT License
136 stars 18 forks source link

Cannot create a simple Blazor application with diagrams in readme.md #65

Closed euklad closed 3 years ago

euklad commented 3 years ago

I use Client Blazor App, .NET Standard 2.1, installed Excubo.Blazor.Diagrams 3.4.0 using NuGet

this code is not compiled:

@using Excubo.Blazor.Diagrams

<Diagram @ref="Diagram">
    <Nodes>
        <Node Id="abc" X="500" Y="500">
            Hello node @context.Id
        </Node>
        <Node Id="def" X="1000" Y="500">
            Hello node @context.Id
        </Node>
    </Nodes>
    <Links>
    </Links>
</Diagram>

Error: Severity Code Description Project File Line Suppression State Error CS0118 'Diagram' is a type but is used like a variable BlazorApp15Diagrams C:\Repos\BlazorApp15Diagrams\BlazorApp15Diagrams\Pages\Counter.razor 5 Active

euklad commented 3 years ago

For Blazor Server App it doesn't work either

stefanloerwald commented 3 years ago

It looks like you don't have a field called Diagram in the component:


@code {
   private Diagram Diagram;
}
euklad commented 3 years ago

Thanks a lot for the prompt response. However it is still not working, I see the blank page. Maybe the warnings affect it. This is my build output:

1>------ Rebuild All started: Project: BlazorApp15Diagrams, Configuration: Debug Any CPU ------ 1>CSC : warning CS8032: An instance of analyzer Excubo.Generators.Blazor.SetParametersAsyncGenerator cannot be created from C:\Users\eukla.nuget\packages\excubo.generators.blazor\1.11.2\analyzers\dotnet\cs\Excubo.Generators.Blazor.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. 1>CSC : warning CS8032: An instance of analyzer Excubo.Generators.Blazor.RequiredParameterAnalyzer cannot be created from C:\Users\eukla.nuget\packages\excubo.generators.blazor\1.11.2\analyzers\dotnet\cs\Excubo.Generators.Blazor.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. 1>CSC : warning CS8032: An instance of analyzer Excubo.Generators.Blazor.KeyAnalyzer cannot be created from C:\Users\eukla.nuget\packages\excubo.generators.blazor\1.11.2\analyzers\dotnet\cs\Excubo.Generators.Blazor.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. 1>CSC : warning CS8032: An instance of analyzer Excubo.Generators.Blazor.EventParameterGenerator cannot be created from C:\Users\eukla.nuget\packages\excubo.generators.blazor\1.11.2\analyzers\dotnet\cs\Excubo.Generators.Blazor.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. 1>CSC : warning CS8032: An instance of analyzer Excubo.Generators.Grouping.GroupingGenerator cannot be created from C:\Users\eukla.nuget\packages\excubo.generators.grouping\1.4.1\analyzers\dotnet\cs\ApiGroupGenerator.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. 1>BlazorApp15Diagrams -> C:\repos\BlazorApp15Diagrams\BlazorApp15Diagrams\bin\Debug\netstandard2.1\BlazorApp15Diagrams.dll 1>BlazorApp15Diagrams (Blazor output) -> C:\repos\BlazorApp15Diagrams\BlazorApp15Diagrams\bin\Debug\netstandard2.1\wwwroot 1>Done building project "BlazorApp15Diagrams.csproj". ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

stefanloerwald commented 3 years ago

I'm guessing that you're running into this issue, which is an issue with CSS, not with this library: https://github.com/excubo-ag/Blazor.Diagrams/issues/63

euklad commented 3 years ago

any suggestions, what I can try to render the diagrams in my project?

stefanloerwald commented 3 years ago

It is unclear to me what you want me to suggest here. Did you make sure that the diagram has a height greater than zero, as in #63?

euklad commented 3 years ago

Uh I see now, if I add style="height:800px" to MainLayout.razor I can see the diagram. Thanks a lot 👍 May I suggest you update readme.md file and include

@code {
   private Diagram Diagram;
}

and this MainLayout.razor changes that required to start?

Thank you.