Skip to content
Merged
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
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

env:
SOLUTION: MemoryX.sln
# Pinned so the build stays reproducible as runner images change.
REFERENCE_ASSEMBLIES_VERSION: 1.0.3

jobs:
build:
name: Build (${{ matrix.configuration }})
# MemoryX targets .NET Framework 4.5.2 and P/Invokes kernel32, so it needs a
# Windows runner with MSBuild rather than the cross-platform `dotnet` CLI.
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]

steps:
- name: Check out the repository
uses: actions/checkout@v7

- name: Set up MSBuild
uses: microsoft/setup-msbuild@v3

- name: Set up NuGet
uses: NuGet/setup-nuget@v4

- name: Restore NuGet packages
run: nuget restore $env:SOLUTION

- name: Provision .NET Framework 4.5.2 reference assemblies
# The hosted image now ships Visual Studio 18, which dropped the 4.5.2
# targeting pack, so MSBuild fails with MSB3644. This package supplies
# the reference assemblies, which keeps the build reproducible instead
# of depending on whichever targeting packs a runner happens to have.
# Nothing here changes how the projects build in Visual Studio.
run: |
nuget install Microsoft.NETFramework.ReferenceAssemblies.net452 `
-Version $env:REFERENCE_ASSEMBLIES_VERSION `
-OutputDirectory packages -ExcludeVersion -NonInteractive

# MSBuild's GetReferenceAssemblyPaths task resolves the framework at
# <RootPath>\.NETFramework\v4.5.2, so locate that folder in the
# downloaded package rather than assuming its internal layout.
$v452 = Get-ChildItem packages -Recurse -Directory -Filter 'v4.5.2' |
Where-Object { $_.Parent.Name -eq '.NETFramework' } |
Select-Object -First 1

if (-not $v452) {
throw "Could not find .NETFramework\v4.5.2 reference assemblies in the downloaded package."
}

$root = $v452.Parent.Parent.FullName
Write-Host "Using TargetFrameworkRootPath=$root"
"TARGET_FRAMEWORK_ROOT_PATH=$root" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

- name: Build the solution
run: >-
msbuild $env:SOLUTION
/p:Configuration=${{ matrix.configuration }}
/p:Platform="Any CPU"
/p:TargetFrameworkRootPath="$env:TARGET_FRAMEWORK_ROOT_PATH"
/m
/nologo
/verbosity:minimal

- name: Upload build output
uses: actions/upload-artifact@v7
with:
name: MemoryX-${{ matrix.configuration }}
path: |
MemoryX/bin/${{ matrix.configuration }}/
MemoryXTest/bin/${{ matrix.configuration }}/
if-no-files-found: error
9 changes: 6 additions & 3 deletions MemoryXTest/MemoryXTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MemoryX">
<HintPath>..\MemoryX\bin\Debug\MemoryX.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -53,5 +50,11 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MemoryX\MemoryX.csproj">
<Project>{DF85FBCD-1829-4587-87C1-68C4E25E2EA1}</Project>
<Name>MemoryX</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# MemoryX

[![Build](https://github.com/ayuthmang/MemoryX/actions/workflows/build.yml/badge.svg)](https://github.com/ayuthmang/MemoryX/actions/workflows/build.yml)

The memory library for .NET applications helps you access Windows APIs such as `WriteProcessMemory` or `ReadProcessMemory` in the simplest way.

⚠️ This project is no longer active and maintained. Feel free to use code inside or forks and add new functionality to meet your needs.
Expand Down