[.Net 6.0.102] dotnet pack - Microsoft.NET.Sdk.Razor.StaticWebAssets.targets NotFoundException
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hello guys, I found the Issue with very similar question, link below: Microsoft.NET.Sdk.Razor.StaticWebAssets.targets DirectoryNotFoundException maybe the same too: MauiRazorClassLibrary sometimes doesn’t build when building the SLN, causing StaticWebAssets to fail
but the defferent is, I have same problem when packing instead of building
here’s my csproj file setting:
<PropertyGroup> <TargetFramework>net6.0</TargetFramework> <!-- <IncludeContentInPack>true</IncludeContentInPack> --> <IsPackable>true</IsPackable> <!-- <IncludeBuildOutput>false</IncludeBuildOutput> --> <!-- <ContentTargetFolders>content</ContentTargetFolders> --> <EnableDefaultContentItems>false</EnableDefaultContentItems> <!-- <NoDefaultExcludes>true</NoDefaultExcludes> --> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> <!-- <PackageOutputPath>.</PackageOutputPath> --> </PropertyGroup>
when I run commend of dotnet pack, will get the result like:
dotnet\sdk\6.0.102\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(522,5): error : Manifest file at 'src\NineYi.ExtTemplate\obj\Debug\net6.0\staticwebassets.build.json' not found. [src\NineYi.ExtTemplate\NineYi.ExtTemplate.csproj]
Expected Behavior
can be pack well without this problem
Steps To Reproduce
No response
Exceptions (if any)
dotnet\sdk\6.0.102\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(522,5): error : Manifest file at ‘src\NineYi.ExtTemplate\obj\Debug\net6.0\staticwebassets.build.json’ not found. [src\NineYi.ExtTemplate\NineYi.ExtTemplate.csproj]
.NET Version
6.0.102
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
@charleschang0531 thanks for the additional details.
It seems that you are building a project to create templates but you are referencing the web sdk
<Project Sdk="Microsoft.NET.Sdk.Web">
I believe you should reference the plain .NET SDK<Project Sdk="Microsoft.NET.Sdk">
instead and that would avoid this issue.Alternatively, since this won’t be using static web assets, you can turn the entire feature off with
<EnableStaticWebAssets>false</EnableStaticWebAssets>
on your csproj.Now I’m comfuse with what’s the difference between
<Project Sdk="Microsoft.NET.Sdk.Web">
and<Project Sdk="Microsoft.NET.Sdk">
, but that’s my homework !! Thanks for the help, it’s efficient and it work.