Skip to content

Commit

Permalink
bugfix: fixes bug preventing templates to be properly loaded in any e…
Browse files Browse the repository at this point in the history
…nvironment

closes nuyonu#52
  • Loading branch information
tcortega committed Jul 8, 2022
1 parent eedd4d7 commit dae10de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
21 changes: 14 additions & 7 deletions src/N-Tier.Application/N-Tier.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -7,15 +7,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1"/>
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.4"/>
<PackageReference Include="MailKit" Version="2.15.0"/>
<PackageReference Include="MimeKit" Version="2.15.1"/>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.4" />
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="MimeKit" Version="2.15.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\N-Tier.DataAccess\N-Tier.DataAccess.csproj"/>
<ProjectReference Include="..\N-Tier.DataAccess\N-Tier.DataAccess.csproj" />
</ItemGroup>

<ItemGroup>
<None Remove="Templates\confirmation_email.html" />
<Content Include="Templates\confirmation_email.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions src/N-Tier.Application/Services/Impl/TemplateService.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Reflection;

namespace N_Tier.Application.Services.Impl;
namespace N_Tier.Application.Services.Impl;

public class TemplateService : ITemplateService
{
private readonly string _templatesPath;

public TemplateService()
{
var projectPath = Directory.GetParent(Directory.GetCurrentDirectory()).FullName;
var templateProject = Assembly.GetExecutingAssembly().GetName().Name;

_templatesPath = Path.Combine(projectPath, templateProject, "Templates");
_templatesPath = Path.Combine(AppContext.BaseDirectory, "Templates");
}

public async Task<string> GetTemplateAsync(string templateName)
Expand Down

0 comments on commit dae10de

Please sign in to comment.