dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 10k forks source link

Unable to publish while using Load on demand to publish the project #46315

Open 239573049 opened 1 year ago

239573049 commented 1 year ago

Is there an existing issue for this?

Describe the bug

Unable to publish while using Load on demand to publish the project image

Expected Behavior

No response

Steps To Reproduce

Add assemblies that are loaded on demand Then use publish to deploy the project

    <ItemGroup>
        <BlazorWebAssemblyLazyLoad Include="System.Xml.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.XmlSerializer.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.XmlDocument.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.XPath.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.XPath.XDocument.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.XDocument.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.Serialization.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.ReaderWriter.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Xml.Linq.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Windows.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Quic.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Compression.ZipFile.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Runtime.Numerics.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Collections.Immutable.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Win32.Registry.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Web.HttpUtility.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.ValueTuple.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.AccessControl.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Mail.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.NameResolution.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.UnmanagedMemoryStream.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Pipes.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Pipes.AccessControl.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Pipelines.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.FileSystem.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.FileSystem.Watcher.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.FileSystem.Primitives.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.FileSystem.DriveInfo.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.FileSystem.AccessControl.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Data.Common.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.CSharp.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Console.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Core.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Data.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Data.DataSetExtensions.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Drawing.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Drawing.Primitives.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.TraceSource.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.Tools.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.TextWriterTraceListener.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.StackTrace.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.Process.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.FileVersionInfo.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.DiagnosticSource.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.Debug.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Diagnostics.Contracts.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.AspNetCore.Authorization.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.AspNetCore.Components.Forms.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.AspNetCore.Metadata.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Extensions.Configuration.Binder.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Extensions.FileProviders.Abstractions.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Extensions.FileProviders.Physical.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Extensions.Configuration.FileExtensions.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Extensions.FileSystemGlobbing.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.MemoryMappedFiles.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.IsolatedStorage.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Compression.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Compression.FileSystem.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.IO.Compression.Brotli.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Formats.Tar.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Formats.Asn1.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.WebSockets.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Private.DataContractSerialization.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Private.Xml.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.VisualBasic.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.VisualBasic.Core.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Threading.Tasks.Dataflow.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Text.Encoding.CodePages.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.WebSockets.Client.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Private.Xml.Linq.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Text.RegularExpressions.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Sockets.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.WebClient.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.WebProxy.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Ping.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.X509Certificates.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.WebHeaderCollection.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.OpenSsl.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.Encoding.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.Csp.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.Cng.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Claims.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Security.Cryptography.Algorithms.dll" />
        <BlazorWebAssemblyLazyLoad Include="Microsoft.Win32.Primitives.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.HttpListener.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.AppContext.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.NetworkInformation.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Requests.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Primitives.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Security.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.ServicePoint.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Http.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Globalization.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Globalization.Calendars.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Globalization.Extensions.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Net.Http.Json.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Web.dll" />
        <BlazorWebAssemblyLazyLoad Include="WindowsBase.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Resources.Writer.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Resources.ResourceManager.dll" />
        <BlazorWebAssemblyLazyLoad Include="System.Resources.Reader.dll" />
    </ItemGroup>

Exceptions (if any)

No response

.NET Version

SDK dotent 7

Anything else?

This is the configuration and error information loaded on demand

C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(532,5): 错误 BLAZORSDK1001: Unable to find 'System.Xml.dll;System.Xml.XmlSerializer.dll;System.Xml.XmlDocument.dll;System.Xml.XPath.dll;System.Xml.XPath.XDocument.dll;System.Xml.XDocument.dll;System.Xml.Serialization.dll;System.Xml.ReaderWriter.dll;System.Xml.Linq.dll;System.Windows.dll;System.Net.Quic.dll;System.IO.Compression.ZipFile.dll;System.Runtime.Numerics.dll;System.Collections.Immutable.dll;Microsoft.Win32.Registry.dll;System.Web.HttpUtility.dll;System.ValueTuple.dll;System.Security.AccessControl.dll;System.Net.Mail.dll;System.Net.NameResolution.dll;System.IO.dll;System.IO.UnmanagedMemoryStream.dll;System.IO.Pipes.dll;System.IO.Pipes.AccessControl.dll;System.IO.Pipelines.dll;System.IO.FileSystem.dll;System.IO.FileSystem.Watcher.dll;System.IO.FileSystem.Primitives.dll;System.IO.FileSystem.DriveInfo.dll;System.IO.FileSystem.AccessControl.dll;System.Data.Common.dll;Microsoft.CSharp.dll;System.Console.dll;System.Core.dll;System.Data.dll;System.Data.DataSetExtensions.dll;System.Drawing.dll;System.Drawing.Primitives.dll;System.Diagnostics.TraceSource.dll;System.Diagnostics.Tools.dll;System.Diagnostics.TextWriterTraceListener.dll;System.Diagnostics.StackTrace.dll;System.Diagnostics.Process.dll;System.Diagnostics.FileVersionInfo.dll;System.Diagnostics.DiagnosticSource.dll;System.Diagnostics.Debug.dll;System.Diagnostics.Contracts.dll;Microsoft.AspNetCore.Authorization.dll;Microsoft.AspNetCore.Components.Forms.dll;Microsoft.AspNetCore.Metadata.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.FileProviders.Abstractions.dll;Microsoft.Extensions.FileProviders.Physical.dll;Microsoft.Extensions.Configuration.FileExtensions.dll;Microsoft.Extensions.FileSystemGlobbing.dll;System.IO.MemoryMappedFiles.dll;System.IO.IsolatedStorage.dll;System.IO.Compression.dll;System.IO.Compression.FileSystem.dll;System.IO.Compression.Brotli.dll;System.Formats.Tar.dll;System.Formats.Asn1.dll;System.Net.WebSockets.dll;System.Private.DataContractSerialization.dll;System.Private.Xml.dll;System.Security.Cryptography.dll;Microsoft.VisualBasic.dll;Microsoft.VisualBasic.Core.dll;System.Threading.Tasks.Dataflow.dll;System.Text.Encoding.CodePages.dll;System.Net.WebSockets.Client.dll;System.Private.Xml.Linq.dll;System.Text.RegularExpressions.dll;System.Net.Sockets.dll;System.Net.WebClient.dll;System.Net.WebProxy.dll;System.Net.Ping.dll;System.Security.Cryptography.X509Certificates.dll;System.Net.WebHeaderCollection.dll;System.Security.Cryptography.OpenSsl.dll;System.Security.Cryptography.Encoding.dll;System.Security.Cryptography.Csp.dll;System.Security.Cryptography.Cng.dll;System.Security.Claims.dll;System.Security.Cryptography.Algorithms.dll;Microsoft.Win32.Primitives.dll;System.Net.HttpListener.dll;System.AppContext.dll;System.Net.NetworkInformation.dll;System.Net.Requests.dll;System.Net.Primitives.dll;System.Net.Security.dll;System.Net.dll;System.Net.ServicePoint.dll;System.Net.Http.dll;System.Globalization.dll;System.Globalization.Calendars.dll;System.Globalization.Extensions.dll;System.Net.Http.Json.dll;System.Web.dll;WindowsBase.dll;System.Resources.Writer.dll;System.Resources.ResourceManager.dll;System.Resources.Reader.dll' to be lazy loaded later. Confirm that project or package references are included and the reference is used in the project.

mkArtakMSFT commented 1 year ago

Thanks for contacting us. Lazy Loading feature should not be used for trying to load core runtime assemblies. Looks like we can improve our docs to clarify this and we will use this issue to track that work.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

239573049 commented 1 year ago

Thanks for contacting us. Lazy Loading feature should not be used for trying to load core runtime assemblies. Looks like we can improve our docs to clarify this and we will use this issue to track that work.

I found the problem, when publishing webassembly it was clipped by default, but when loading on demand it was clipped after the clipping. The problem was caused by not being able to find the clipped assembly when loading on demand was used.

ghost commented 9 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

mkArtakMSFT commented 9 months ago

Lazy Loading feature should not be used for trying to load core runtime assemblies.

@guardrex can you please include this in Blazor Lazy Loading docs ? Thanks

guardrex commented 9 months ago

@mkArtakMSFT ... The PR is here ...

https://github.com/dotnet/AspNetCore.Docs/pull/31407

It will need review because I say why based on @239573049's comment above about trimming removing a number of them at publish. It's nice to know why if we can state the reason. I'm 👂 on the PR if providing the reason is ok and stated correctly.

UPDATE (1/11): I went ahead and merged it with the reason, which I'll patch out if you want. I'm trying to get PRs in and issues closed to slim my rather large backlog right now ⛰️⛏️😅.