WebOptimizer
WebOptimizer copied to clipboard
WebOptimizer for .NET 5
Does WebOptimizer work with .NET 5?
Seems to be working fine for me.
Yes working here too (y)
I will say, I am experiencing an issue where none of my CSS loads on first-load and there is an error in the console.
I will say, I am experiencing an issue where none of my CSS loads on first-load and there is an error in the console.
What error you get?
in startup.cs "configure" I have: app.UseWebOptimizer(); app.UseStaticFiles();
and in "configureservices" I have: services.AddWebOptimizer(pipeline => { pipeline.AddCssBundle("/css/bundle.css", "lib/bootstrap/dist/css/bootstrap.css", "css/animate.css", "css/site.css"); pipeline.AddJavaScriptBundle("/js/bundle.js", "lib/jquery/dist/jquery.js", "/lib/bootstrap/dist/js/bootstrap.bundle.js"); });
and then use in view:
<link rel="stylesheet" href="/css/bundle.css" />
and
/T
@Jalinco1 This is the issue I am having, I commented here as well. https://github.com/ligershark/WebOptimizer/issues/55
I am having issues with it when I try to make a pipeline in azure devops.
##[error]The nuget command failed with exit code(1) and error(NU1202: Package LigerShark.WebOptimizer.Sass 3.0.58-beta is not compatible with net50 (.NETFramework,Version=v5.0). Package LigerShark.WebOptimizer.Sass 3.0.58-beta supports: netcoreapp3.0 (.NETCoreApp,Version=v3.0)
That's from the nuGet Restore step in my pipeline. I can build it without any issues locally so it is perfectly possible that I just don't know what I'm doing.
@casualinnovations Is your azure build agent building using the .net3.0 SDK?
@casualinnovations Is your azure build agent building using the .net3.0 SDK?
It is failing during the NuGet Restore step, before building. YAML for Nuget Restore.
steps:
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
vstsFeed: '971cc896-394f-4815-b290-e9d5c1b95ff6'
My project is configured for 5.0
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<AssemblyName>CasualFrontend</AssemblyName>
</PropertyGroup>
Try using the dotnet cli restore cmd instead of NuGetCommand@2
Having the same issues. afew notes:
- deploying on a linux azure app service
- .net 6
- occurs usually after deployment, hit the css or js url directly and get a server 500 error, this would go away after afew hits
I have disabled disk caching from appsettings.json and the issue no longer appears to occur - obviously this carries memory penalties and startup / cold start penalties... but works for me
"webOptimizer": { "enableCaching": true, "enableMemoryCache": true, "enableDiskCache": false, "cacheDirectory": "/var/temp/weboptimizercache", "enableTagHelperBundling": false, "cdnUrl": "https://my-cdn.com/", "allowEmptyBundle": false },
my conclusion is that certain environments require cache directory path (which would be dependent on deployed environment / operating system) to be setup correctly, or disk cache to be disabled....
@matthew-yee
my conclusion is that certain environments require cache directory path (which would be dependent on deployed environment / operating system) to be setup correctly, or disk cache to be disabled....
This is correct.
We should PR enableDiskCache
set to false by default thereby making it opt-in instead of opt-out. We can update the docs to call this out, and update the samples to comment it out and describe how it works.
It clearly breaks in enough situations while on, compared to no problems if its turned off.