csproj tweaks to support app publish

pull/49/head
cosmonaut 2023-05-22 18:28:13 -07:00
parent 300ef9f88e
commit adeba633e5
2 changed files with 4 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFramework>net7.0</TargetFramework>
<Platforms>x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>11</LangVersion>
@ -22,6 +22,7 @@
<ItemGroup>
<None Include="MoonWorks.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -97,16 +97,12 @@ namespace MoonWorks
// Get the path to the assembly
Assembly assembly = Assembly.GetExecutingAssembly();
string assemblyPath = "";
if (assembly.Location != null)
{
assemblyPath = Path.GetDirectoryName(assembly.Location);
}
string assemblyPath = System.AppContext.BaseDirectory;
// Locate the config file
string xmlPath = Path.Combine(
assemblyPath,
assembly.GetName().Name + ".dll.config"
"MoonWorks.dll.config"
);
if (!File.Exists(xmlPath))
{