VC-LTL5
VC-LTL5 copied to clipboard
Add .NET native AOT support
Perhaps we can find a way to run ,NET but natively compiled down version. Because if Rust can be dealt with, why not .NET, or even Golang?
After some research I think this is actually possible, take a look at this:
https://github.com/dotnet/runtime/blob/d3ab95d3be895a1950a46c559397780dbb3e9807/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets
Maybe we can just find a way to override the MSBuild property SdkNativeLibrary to inject VC-LTL based libraries in Microsoft.NETCore.Native.Windows.targets
?
There it goes:
<ItemGroup>
<SdkNativeLibrary Include="advapi32.lib" />
<SdkNativeLibrary Include="bcrypt.lib" />
<SdkNativeLibrary Include="crypt32.lib" />
<SdkNativeLibrary Include="iphlpapi.lib" />
<SdkNativeLibrary Include="kernel32.lib" />
<SdkNativeLibrary Include="mswsock.lib" />
<SdkNativeLibrary Include="ncrypt.lib" />
<SdkNativeLibrary Include="normaliz.lib" />
<SdkNativeLibrary Include="ntdll.lib" />
<SdkNativeLibrary Include="ole32.lib" />
<SdkNativeLibrary Include="oleaut32.lib" />
<SdkNativeLibrary Include="secur32.lib" />
<SdkNativeLibrary Include="user32.lib" />
<SdkNativeLibrary Include="version.lib" />
<SdkNativeLibrary Include="ws2_32.lib" />
<SdkNativeLibrary Include="F:\VC-LTL-5.0.9-Binary\TargetPlatform\6.2.9200.0\lib\x64\libucrt.lib" />
<SdkNativeLibrary Include="F:\VC-LTL-5.0.9-Binary\TargetPlatform\6.2.9200.0\lib\x64\libvcruntime.lib" />
</ItemGroup>
<ItemGroup Condition="!Exists('$(IlcSdkPath)debugucrt.txt')">
<!-- Force ucrt to be dynamically linked for release runtime -->
<LinkerArg Include="/NODEFAULTLIB:ucrt.lib" />
<LinkerArg Include="/NODEFAULTLIB:vcruntime.lib" />
<LinkerArg Include="/DEFAULTLIB:libucrt.lib" />
<LinkerArg Include="/DEFAULTLIB:libvcruntime.lib" />
</ItemGroup>
Yep, just adding these few <ItemGroup> to csproj, should work on any project:
<ItemGroup>
<SdkNativeLibrary Include="F:\VC-LTL-5.0.9-Binary\TargetPlatform\5.2.3790.0\lib\x64\libucrt.lib" />
<SdkNativeLibrary Include="F:\VC-LTL-5.0.9-Binary\TargetPlatform\5.2.3790.0\lib\x64\libvcruntime.lib" />
<LinkerArg Include="/DEFAULTLIB:libucrt.lib" />
<LinkerArg Include="/DEFAULTLIB:libvcruntime.lib" />
<LinkerArg Include="/NODEFAULTLIB:ucrt.lib" />
<LinkerArg Include="/NODEFAULTLIB:vcruntime.lib" />
</ItemGroup>
So what we need to figure out is how to add the MSBuild support and publish the right version on Nuget...
Looks good.
Kenji Mouri
新版本已经发布 https://github.com/Chuyu-Team/VC-LTL5/releases/tag/v5.0.10-Beta2
新版本已经发布 https://github.com/Chuyu-Team/VC-LTL5/releases/tag/v5.0.10-Beta2
There could be a new README section about how it works, does it just work by installing the Nuget package?
新版本已经发布 https://github.com/Chuyu-Team/VC-LTL5/releases/tag/v5.0.10-Beta2
There could be a new README section about how it works, does it just work by installing the Nuget package? README will update, thanks~
- Install YY-Thunks v5.0.10-Beta2 or leater
- modify the value of TargetFramework to
net8.0-windows
- optional, if you need run on Windows XP, please modify the value of SupportedOSPlatformVersion to
5.1
新版本已经发布 https://github.com/Chuyu-Team/VC-LTL5/releases/tag/v5.0.10-Beta2
There could be a new README section about how it works, does it just work by installing the Nuget package? README will update, thanks~
- Install YY-Thunks v5.0.10-Beta2 or leater
- modify the value of TargetFramework to
net8.0-windows
- optional, if you need run on Windows XP, please modify the value of SupportedOSPlatformVersion to
5.1
Can confirm it worked like a charm:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<InvariantGlobalization>true</InvariantGlobalization>
<TargetFramework>net8.0-windows</TargetFramework>
<!--如果不支持XP这一行不需要添加SupportedOSPlatformVersion-->
<SupportedOSPlatformVersion>5.1</SupportedOSPlatformVersion>
<OptimizationPreference>Size</OptimizationPreference>
<TrimMode>copyused</TrimMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VC-LTL" Version="5.0.10-Beta2" />
<PackageReference Include="YY-Thunks" Version="1.0.10-Beta3" />
</ItemGroup>
</Project>