From 52a896210afc9dae3faf06e0fe6d963bec7abe74 Mon Sep 17 00:00:00 2001 From: Caelan Date: Fri, 20 Sep 2024 22:12:46 -0600 Subject: [PATCH] bring back netstandard2.0 target --- samples/CSharpUnityMono/README.md | 28 +++++++++----------- src/lib-csharp/Internal/SymbolicLink.cs | 10 +++---- src/lib-csharp/Velopack.csproj | 8 +++++- src/vpk/Velopack.Build/Velopack.Build.csproj | 1 - 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/samples/CSharpUnityMono/README.md b/samples/CSharpUnityMono/README.md index d2a8da63..ff101b36 100644 --- a/samples/CSharpUnityMono/README.md +++ b/samples/CSharpUnityMono/README.md @@ -11,17 +11,13 @@ This project integrates Velopack into unity by way of a [nuget for Unity](https: 7. use vpk cli tool to pack your project `vpk pack -u UnityMonoSample -v 0.0.1 -p .\Build -e UnityMonoSample.exe` ## Requirements for your project -install the nuget package `VelocyPack` in your project +install the nuget package `Velopack` in your project you can use tool like [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) ``` openupm add com.github-glitchenzo.nugetforunity ``` -if your .net runtime is .NET Standard 2.0, you need use Velopack 0.0.359 - -for .NET 4.x runtime, you can use the latest version of Velopack - -currently, the Velopack is only support for Unity mono runtime, not support for IL2CPP, due to the following reasons: +Currently, Velopack is only support for Unity mono runtime, it does not support for IL2CPP, due to the following reasons: https://docs.unity3d.com/2022.3/Documentation/Manual/ScriptingRestrictions.html @@ -37,16 +33,16 @@ If you still want to use Velopack in IL2CPP, you can use the following workaroun 1. clone the Velopack repository 2. edit the VelopackRuntimeInfo.cs file like this: ```csharp - static VelopackRuntimeInfo() - { - //delete the following line - //EntryExePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; - EntryExePath = Application.dataPath; - if (!Application.isEditor) - { - EntryExePath = Path.Combine(EntryExePath, "..", Application.productName + ".exe"); - } - } +static VelopackRuntimeInfo() +{ + //delete the following line + //EntryExePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; + EntryExePath = Application.dataPath; + if (!Application.isEditor) + { + EntryExePath = Path.Combine(EntryExePath, "..", Application.productName + ".exe"); + } +} ``` 3. build the Velopack project 4. replace the Velopack.dll in your project with the new Velopack.dll diff --git a/src/lib-csharp/Internal/SymbolicLink.cs b/src/lib-csharp/Internal/SymbolicLink.cs index 32536c11..a52ee850 100644 --- a/src/lib-csharp/Internal/SymbolicLink.cs +++ b/src/lib-csharp/Internal/SymbolicLink.cs @@ -39,14 +39,14 @@ namespace Velopack : targetPath; if (Directory.Exists(targetPath)) { -#if NETFRAMEWORK +#if NETFRAMEWORK || NETSTANDARD if (!CreateSymbolicLink(linkPath, finalTarget, SYMBOLIC_LINK_FLAG_DIRECTORY | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE)) ThrowLastWin32Error("Unable to create junction point / symlink."); #else Directory.CreateSymbolicLink(linkPath, finalTarget); #endif } else if (File.Exists(targetPath)) { -#if NETFRAMEWORK +#if NETFRAMEWORK || NETSTANDARD if (!CreateSymbolicLink(linkPath, finalTarget, SYMBOLIC_LINK_FLAG_FILE | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE)) ThrowLastWin32Error("Unable to create junction point / symlink."); #else @@ -106,7 +106,7 @@ namespace Velopack private static string GetUnresolvedTarget(string linkPath) { if (TryGetLinkFsi(linkPath, out var fsi)) { -#if NETFRAMEWORK +#if NETFRAMEWORK || NETSTANDARD return GetTargetWin32(linkPath); #else @@ -130,7 +130,7 @@ namespace Velopack private static string GetRelativePath(string relativeTo, string path) { -#if NETFRAMEWORK +#if NETFRAMEWORK || NETSTANDARD relativeTo = Path.GetFullPath(relativeTo); path = Path.GetFullPath(path); return ToggleRelative(relativeTo, path); @@ -139,7 +139,7 @@ namespace Velopack #endif } -#if NETFRAMEWORK +#if NETFRAMEWORK || NETSTANDARD [Flags] private enum EFileAttributes : uint { diff --git a/src/lib-csharp/Velopack.csproj b/src/lib-csharp/Velopack.csproj index 25c457c2..4a15cc98 100644 --- a/src/lib-csharp/Velopack.csproj +++ b/src/lib-csharp/Velopack.csproj @@ -2,7 +2,7 @@ - net462;net48;net6.0;net8.0 + netstandard2.0;net462;net48;net6.0;net8.0 enable true 9 @@ -28,6 +28,12 @@ + + + + + + diff --git a/src/vpk/Velopack.Build/Velopack.Build.csproj b/src/vpk/Velopack.Build/Velopack.Build.csproj index 64d16d64..608f7327 100644 --- a/src/vpk/Velopack.Build/Velopack.Build.csproj +++ b/src/vpk/Velopack.Build/Velopack.Build.csproj @@ -22,7 +22,6 @@ -