Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# Custom files
src/
src/Riverside.Win32*

# User-specific files
*.rsuser
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/Riverside.Private.CsWin32"]
path = src/Riverside.Private.CsWin32
url = https://github.com/Lamparter/CsWin32
8 changes: 6 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<RootDirectory>$(MSBuildThisFileDirectory)</RootDirectory>
<CsWin32LocalTargets>$(RootDirectory)\src\Riverside.Private.CsWin32.props</CsWin32LocalTargets>
</PropertyGroup>

<!-- Versioning -->
Expand Down Expand Up @@ -65,13 +68,14 @@
</None>
</ItemGroup>


<!-- Package references -->
<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="*" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
<!--<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</PackageReference>-->
<PackageReference Include="System.Memory" Version="*" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="*" />
</ItemGroup>
Expand Down
12 changes: 10 additions & 2 deletions GenerateSolution.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ param(
)

if (Test-Path $WorkingDirectory) {
Remove-Item -Path $WorkingDirectory -Recurse -Force
Get-ChildItem -Path $WorkingDirectory | Where-Object {
$_.Name -notlike '*Riverside.Private.CsWin32*'
} | Remove-Item -Recurse -Force
}

# Dictionary of DLLs with 'pretty' names
Expand Down Expand Up @@ -94,6 +96,7 @@ foreach ($dll in $dlls.Keys) {
# Add .csproj content
$csprojContent = @"
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="`$(CsWin32LocalTargets)" />
<PropertyGroup>
<Description>Win32 P/Invoke ($dll.dll) bindings for .NET Standard</Description>
<PackageTags>`$(PackageTags); $dll</PackageTags>
Expand All @@ -109,9 +112,10 @@ foreach ($dll in $dlls.Keys) {
# NativeMethods.json
$nativeMethodsConfigContent = @"
{
"`$schema": "https://aka.ms/CsWin32.schema.json",
"`$schema": "..\\Riverside.Private.CsWin32\\src\\Microsoft.Windows.CsWin32\\settings.schema.json",
"allowMarshaling": false,
"public": true,
"namespace": "$projectName",
"comInterop": {
"preserveSigMethods": [
"*"
Expand Down Expand Up @@ -155,4 +159,8 @@ $mainCsprojContent | Set-Content -Path $mainProjectFile

dotnet sln $solutionFile add $mainProjectFile

$CsWin32ProjectDir = Join-Path $WorkingDirectory "Riverside.Private.CsWin32\src\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.csproj"

dotnet sln $solutionFile add $CsWin32ProjectDir

Write-Host "Solution and projects have been successfully created in $WorkingDirectory."
86 changes: 43 additions & 43 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Riverside.Private.CsWin32
27 changes: 27 additions & 0 deletions src/Riverside.Private.CsWin32.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>
<Import Project="$(RootDirectory)\src\Riverside.Private.CsWin32\src\Microsoft.Windows.CsWin32\build\Microsoft.Windows.CsWin32.props" />

<PropertyGroup>
<CsWin32LocalDir>$(RootDirectory)\src\Riverside.Private.CsWin32\</CsWin32LocalDir>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(RootDirectory)\src\Riverside.Private.CsWin32\src\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" GeneratePathProperty="true" PrivateAssets="none" Version="61.0.15-preview" />
</ItemGroup>

<ItemGroup>
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\System.Text.Json.dll" />
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll" />
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\System.Text.Encodings.Web.dll" />
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\Microsoft.Windows.SDK.Win32Docs.dll" />
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\MessagePack.dll" />
<Analyzer Include="$(CsWin32LocalDir)bin\Microsoft.Windows.CsWin32\$(Configuration)\netstandard2.0\MessagePack.Annotations.dll" />
</ItemGroup>

<ProjectExtensions>
<VisualStudio>
<UserProperties nativemethods_1json__JsonSchema="$(RootDirectory)\src\Riverside.Private.CsWin32\src\Microsoft.Windows.CsWin32\settings.schema.json" />
</VisualStudio>
</ProjectExtensions>
</Project>