Skip to content

Commit

Permalink
✨优化发布后找不到项目引用关系 Fixes:#372
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonNoCry committed Oct 24, 2024
1 parent f3641bd commit e9e71c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Blog.Core.Api/Blog.Core.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<PreserveCompilationContext>true</PreserveCompilationContext>
<!--<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>-->
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
Expand Down Expand Up @@ -95,6 +96,9 @@
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\ui.zip">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion Blog.Core.Extensions/ServiceExtensions/CacheSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Serilog;
using StackExchange.Redis;

namespace Blog.Core.Extensions.ServiceExtensions;
Expand All @@ -21,6 +22,7 @@ public static class CacheSetup
public static void AddCacheSetup(this IServiceCollection services)
{
var cacheOptions = App.GetOptions<RedisOptions>();
Console.WriteLine("RedisOptions:{0}", cacheOptions.ToJson());
if (cacheOptions.Enable)
{
// 配置启动Redis服务,虽然可能影响项目启动速度,但是不能在运行的时候报错,所以是合理的
Expand All @@ -35,7 +37,8 @@ public static void AddCacheSetup(this IServiceCollection services)
//使用Redis
services.AddStackExchangeRedisCache(options =>
{
options.ConnectionMultiplexerFactory = () => Task.FromResult(App.GetService<IConnectionMultiplexer>(false));
options.ConnectionMultiplexerFactory =
() => Task.FromResult(App.GetService<IConnectionMultiplexer>(false));
if (!cacheOptions.InstanceName.IsNullOrEmpty()) options.InstanceName = cacheOptions.InstanceName;
});

Expand Down

0 comments on commit e9e71c8

Please sign in to comment.