wwwroot directory is not copied to the tools\net6.0\any directory in a NuGet package [.NET6 + ASP.NET Core]

Viewed 283

Just migrated to the new .NET6 preview. And I have a problem with my NuGet package. I have an ASP.NET Core web application which is a NuGet package.

  • With .NET5 the wwwroot directory was being copied to the tools\net5.0\any folder.
  • With .NET6 the wwwroot directory is not being copied to the tools\net6.0\any folder.

So my web application doesn't work now!

Question is; how to copy the wwwroot into the tools\net6.0\any\wwwroot folder in my *.nupkg file.

I'm using the following command to create NuGet package:

dotnet msbuild /t:pack /p:Configuration=Release /p:SourceLinkCreate=true

This my project.csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <TypeScriptToolsVersion>3.3</TypeScriptToolsVersion>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <ToolCommandName>dummy</ToolCommandName>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
    <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
    <PreserveCompilationReferences>true</PreserveCompilationReferences>
    <IsPackable>true</IsPackable>
    <PackageId>dummy</PackageId>
    <PackAsTool>true</PackAsTool>
  </PropertyGroup>
 
 
  <ItemGroup Condition="'$(Configuration)' == 'Release'">
    <EmbeddedResource Include="Pages\**\*.*" Exclude="*.cs" />
    <Content Remove="Pages\**\*.js" />
    <Content Remove="Pages\**\*.css" />
    <EmbeddedResource Include="Components\**\*.js" />
    <EmbeddedResource Include="Components\**\*.css" />
    <Content Remove="Components\**\*.js" />
    <Content Remove="Components\**\*.css" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="Localization\Resources\**\*.json" />
    <EmbeddedResource Include="Themes\Lepton\Layouts\Application\_Footer.cshtml" />
  </ItemGroup>

  <ItemGroup>
    <Content Remove="Localization\Resources\**\*.json" />
    <Content Remove="compilerconfig.json" />
    <Content Remove="compilerconfig.json.defaults" />
    <Content Remove="Properties\launchSettings.json" />
    <Content Remove="Themes\Lepton\Layouts\Application\_Footer.cshtml" />
    <None Include="compilerconfig.json" />
    <None Include="Properties\launchSettings.json" />
    
  </ItemGroup>

  <ItemGroup>
    <Compile Remove="Logs\**" />
    <Content Remove="Logs\**" />
    <EmbeddedResource Remove="Logs\**" />
    <None Remove="Logs\**" />
  </ItemGroup>
 

</Project>

enter image description here

0 Answers
Related