Skip to content

The content of nuget package is not being copied to the project source code folder physically. They are only appears as if under the project folder #53747

@aDisplayName

Description

@aDisplayName

@javiercn , as far as I know, the content of nuget package is not being copied to the project source code folder physically. They are only appears as if under the project folder as the screenshot shown.

They are being copied over to the project output folder, aka the bin/<Configuration>/<tfm> after the project is being built, but it will be too late.

Is there any SDK style property I can use in the main project's csproj file that I can use to reference the actual physical location of those contents (common-colors.scss) from my RCL? At least I can write some custom build targets to reference those.

Originally posted by @aDisplayName in #53682 (comment)

This is refer to the original question here: #53682. If the content of nuget package were copied over to the project, at which stage the file is being copied over and to where?

If it showing up under the project source code folder, how to reference it by other source code?


In Angular Project, the reusable SCSS is being deployed via node modules using npm. But for C# Blazor project, we would like to see the similar solution by using RCL / nuget.

In our case, we have created a common-color.scss file to provide a common color code definitions.

Project: SharedColor.csproj / Styles / common-color.scss

// COMMON COLORS
$_color-black: #000;
$_color-white: #fff;

What we would like to achieve, is to package this common-color.scss into the SharedColor.nupkg as source code, and allow the project importing this nuget package to be able to reuse the file with their own .scss files:

Project: BlazorApp1.csproj / Page / index.razor.scss

@import "../Styles/common-colors.scss";

.info {
    color: $_color-black;
}

We are using AspNetCore.SassCompiler to convert index.razor.scss into index.razor.css during the build.

When building project, as shown below, An error was thrown because the build task Compile Sass from AspNetCore.SassCompiler could not find file /Styles/common-colors.scss under the project folder BlazorApp1 at the time the task was performed, as we can see the file is actually located under %USERPROFILE%\.nuget\packages\sharedcolor\1.0.0\contentFiles\any\net8.0\Styles\common-colors.scss

image

My question is

  1. What are those icons called in solution explorer mean?
    image
    Is there a term/name for those items "virtually showed up" from nuget package into the host project's 'virtual folder'?
  2. Is there such a task stage during the build, that all those assets from nuget packages are combined/overlayed with the files located in the project folder, so that the source code files from the nuget package, can be directly referenced in SCSS / SASS 's import or use statement? It would be useful to compile front-end artifacts without rely on NPM.

Regards

The code example can be found at here

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions