bring back netstandard2.0 target

This commit is contained in:
Caelan
2024-09-20 22:12:46 -06:00
parent b828850b45
commit 52a896210a
4 changed files with 24 additions and 23 deletions

View File

@@ -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,8 +33,8 @@ 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()
{
static VelopackRuntimeInfo()
{
//delete the following line
//EntryExePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
EntryExePath = Application.dataPath;
@@ -46,7 +42,7 @@ If you still want to use Velopack in IL2CPP, you can use the following workaroun
{
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

View File

@@ -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
{

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net48;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net462;net48;net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>9</LangVersion>
@@ -28,6 +28,12 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0,)" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard2')) ">
<PackageReference Include="Newtonsoft.Json" Version="[13.0.1,)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0,)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework) == 'net6.0' ">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[6.0.0,)" />
</ItemGroup>

View File

@@ -22,7 +22,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.10.4" />
<PackageReference Include="Microsoft.IO.Redist" Version="6.0.1" />
<PackageReference Include="Riok.Mapperly" Version="3.6.0" />
</ItemGroup>