diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-30 18:14:40 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-30 18:14:40 -0400 |
commit | 4af0786ecb6b16826b2a23b1448c3ab8f5ccd569 (patch) | |
tree | 2d2f6292cbce5432e71c4aac643b3a157599c2e5 /src | |
parent | b5adfd8bce12afb885d6bb6a347d25e33be602af (diff) | |
download | SMAPI-4af0786ecb6b16826b2a23b1448c3ab8f5ccd569.tar.gz SMAPI-4af0786ecb6b16826b2a23b1448c3ab8f5ccd569.tar.bz2 SMAPI-4af0786ecb6b16826b2a23b1448c3ab8f5ccd569.zip |
fix assembly load security exceptions by restructuring installer and adding *.exe.config files (#582, #588)
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI.Installer/InteractiveInstaller.cs | 2 | ||||
-rw-r--r-- | src/SMAPI.Installer/Program.cs | 8 | ||||
-rw-r--r-- | src/SMAPI.Installer/StardewModdingAPI.Installer.csproj | 8 | ||||
-rw-r--r-- | src/SMAPI.Installer/windows-exe-config.xml | 5 | ||||
-rw-r--r-- | src/SMAPI.Installer/windows-install.bat | 1 |
5 files changed, 15 insertions, 9 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index e6e71cf4..1da5c35a 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -440,7 +440,7 @@ namespace StardewModdingApi.Installer this.PrintDebug("Adding SMAPI files..."); foreach (FileSystemInfo sourceEntry in paths.PackageDir.EnumerateFileSystemInfos().Where(this.ShouldCopy)) { - if (sourceEntry.Name == this.InstallerFileName) + if (sourceEntry.Name.StartsWith(this.InstallerFileName)) // e.g. install.exe or install.exe.config continue; this.InteractivelyDelete(Path.Combine(paths.GameDir.FullName, sourceEntry.Name)); diff --git a/src/SMAPI.Installer/Program.cs b/src/SMAPI.Installer/Program.cs index 375678d2..ad5cf47f 100644 --- a/src/SMAPI.Installer/Program.cs +++ b/src/SMAPI.Installer/Program.cs @@ -2,7 +2,6 @@ using System; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; -using StardewModdingAPI.Internal; namespace StardewModdingApi.Installer { @@ -14,8 +13,7 @@ namespace StardewModdingApi.Installer *********/ /// <summary>The absolute path to search for referenced assemblies.</summary> [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute", Justification = "The assembly location is never null in this context.")] - private static string DllSearchPath; - + private static readonly string DllSearchPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "smapi-internal"); /********* ** Public methods @@ -25,10 +23,6 @@ namespace StardewModdingApi.Installer public static void Main(string[] args) { // set up assembly resolution - string installerPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - Program.DllSearchPath = EnvironmentUtility.DetectPlatform() == Platform.Windows - ? Path.Combine(installerPath, "internal", "Windows", "smapi-internal") - : Path.Combine(installerPath, "smapi-internal"); AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve; // launch installer diff --git a/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj b/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj index e9af16c5..22c55af7 100644 --- a/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj +++ b/src/SMAPI.Installer/StardewModdingAPI.Installer.csproj @@ -46,11 +46,17 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> - <Content Include="readme.txt"> + <Content Include="README.txt"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> + <Content Include="windows-exe-config.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <None Include="windows-install.bat"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> <None Include="unix-install.sh"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> diff --git a/src/SMAPI.Installer/windows-exe-config.xml b/src/SMAPI.Installer/windows-exe-config.xml new file mode 100644 index 00000000..386c7f1a --- /dev/null +++ b/src/SMAPI.Installer/windows-exe-config.xml @@ -0,0 +1,5 @@ +<configuration> + <runtime> + <loadFromRemoteSources enabled="true"/> + </runtime> +</configuration> diff --git a/src/SMAPI.Installer/windows-install.bat b/src/SMAPI.Installer/windows-install.bat new file mode 100644 index 00000000..716c7789 --- /dev/null +++ b/src/SMAPI.Installer/windows-install.bat @@ -0,0 +1 @@ +START /WAIT /B internal/Windows/install.exe |