Create NuGet for WSLC SDK (#14388)

This commit is contained in:
Flor Chacón
2026-03-13 11:09:27 -07:00
committed by GitHub
parent a27d36053d
commit 3c9c3e16c5
10 changed files with 56 additions and 29 deletions

View File

@@ -19,6 +19,7 @@ parameters:
type: object
default:
- Microsoft.WSL.PluginApi.nuspec
- Microsoft.WSL.Containers.nuspec
- name: traceLoggingConfig
type: string

View File

@@ -7,6 +7,7 @@ parameters:
type: object
default:
- Microsoft.WSL.PluginApi
- Microsoft.WSL.Containers
stages:
- stage: nuget

View File

@@ -1,4 +1,4 @@
set(NUGET_PACKAGES Microsoft.WSL.PluginApi.nuspec)
set(NUGET_PACKAGES Microsoft.WSL.PluginApi.nuspec Microsoft.WSL.Containers.nuspec)
# generate vars with native paths since nuget won't accept unix path separators
cmake_path(NATIVE_PATH CMAKE_SOURCE_DIR CMAKE_SOURCE_DIR_NATIVE)

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="WSLForApps_ErrorNoPlatform" BeforeTargets="BeforeBuild" Condition="'$(WSLForApps-Platform)' == ''">
<Error Text="wslaclient.dll could not be copied because the AnyCPU platform is being used. Please specify a platform to copy this file, using either RuntimeIdentifier, an architecture specific Platform, or explicitly with WSLForApps-Platform." />
</Target>
<ItemGroup>
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(WSLForApps-Platform)\wslaclient.dll" />
</ItemGroup>
</Project>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(WSLForApps-Platform)' == ''">
<WSLForApps-Platform Condition="$(RuntimeIdentifier.EndsWith('-x64'))">x64</WSLForApps-Platform>
<WSLForApps-Platform Condition="$(RuntimeIdentifier.EndsWith('-arm64'))">arm64</WSLForApps-Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(WSLForApps-Platform)' == ''">
<WSLForApps-Platform Condition="'$(Platform)' != 'AnyCPU'">$(Platform)</WSLForApps-Platform>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WSL.API.common.targets" />
</Project>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.WSL.Containers</id>
<version>${WSL_NUGET_PACKAGE_VERSION}</version>
<authors>Microsoft</authors>
<projectUrl>https://github.com/microsoft/WSL</projectUrl>
<description>WSL Containers SDK</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>WSL</tags>
<language>en-us</language>
<license type="expression">MIT</license>
<readme>docs\README.MD</readme>
</metadata>
<files>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\src\windows\WslcSDK\wslcsdk.h" target="include"/>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\bin\x64\Release\wslcsdk.lib" target="runtimes\win-x64"/>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\bin\x64\Release\wslcsdk.dll" target="runtimes\win-x64"/>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\bin\arm64\Release\wslcsdk.lib" target="runtimes\win-arm64"/>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\bin\arm64\Release\wslcsdk.dll" target="runtimes\win-arm64"/>
<file src="${CMAKE_SOURCE_DIR_NATIVE}\nuget\Microsoft.WSL.Containers\**"/>
</files>
</package>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="WSLCSDK_ErrorNoPlatform" BeforeTargets="PrepareForBuild" Condition="'$(WSLCSDK_Platform)' == ''">
<Error Text="wslcsdk.dll could not be copied because the AnyCPU platform is being used. Please specify a platform to copy this file, using either RuntimeIdentifier, an architecture specific Platform, or explicitly with WSLCSDK_Platform." />
</Target>
<ItemGroup>
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(WSLCSDK_Platform)\wslcsdk.dll" />
</ItemGroup>
</Project>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(WSLCSDK_Platform)' == ''">
<WSLCSDK_Platform>$(Platform)</WSLCSDK_Platform>
</PropertyGroup>
<ItemDefinitionGroup>
<PropertyGroup Condition="'$(WSLForApps-Platform)' == ''">
<WSLForApps-Platform>$(Platform)</WSLForApps-Platform>
</PropertyGroup>
<ClCompile>
<AdditionalIncludeDirectories>
$(MSBuildThisFileDirectory)..\..\include;
@@ -12,7 +12,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>
wslaclient.lib;
wslcsdk.lib;
%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>
@@ -21,4 +21,6 @@
</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WSL.Containers.common.targets" />
</Project>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(WSLCSDK_Platform)' == ''">
<WSLCSDK_Platform Condition="$(RuntimeIdentifier.EndsWith('-x64'))">x64</WSLCSDK_Platform>
<WSLCSDK_Platform Condition="$(RuntimeIdentifier.EndsWith('-arm64'))">arm64</WSLCSDK_Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(WSLCSDK_Platform)' == ''">
<WSLCSDK_Platform Condition="'$(Platform)' != 'AnyCPU'">$(Platform)</WSLCSDK_Platform>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WSL.Containers.common.targets" />
</Project>