Skip to content

Razor Class Library doesn't load well without a solution file at the parent level #11482

@davidwengier

Description

@davidwengier

Discovered from a report of bad behaviour on Reddit: https://www.reddit.com/r/Blazor/comments/1imjygr/rz10012_components_from_razor_class_library_not/

We don't handle it well when there is a Razor Class Library, and the solution is not in the parent folder.

So for example given this layout:

App\
    App\
        App.csproj
        App.sln
    RCL\
        RCL.csproj

RCLs don't have an absolute BaseIntermediateOutputPath, so we end up seeing <current directory>\obj as the obj path, and we have a Directory.Exists check that catches if that happens, and falls back to different logic for an RCL. Turns out current directory is the solution folder, and so that obj path does exist, but it exists for a different project, and then all sorts of fun shenanigans ensue.

A workaround is to move the sln file up a level. ie:

App\
    App.sln
    App\
        App.csproj
    RCL\
        RCL.csproj

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions