Skip to content

Conversation

@culix-7
Copy link

@culix-7 culix-7 commented Jan 3, 2026

tldr:

  • Move WindowsPreBuild steps to .bat file
  • Add %~f path expansion for Dependencies.zip file so the build uses the fully qualified path

..

Hello, thank you so much for creating and sharing Mesen. It is absolutely fantastic. I very much enjoy using it and I wanted to try to give something back.

When building in Visual Studio on Windows 10 at the latest Mesen code - commit fabc9a6 - I get an error about "The file cannot be accessed" while building the UI project:

8>------ Build started: Project: UI, Configuration: Release x64 ------
8>C:\code\mesen\UI\Dependencies\MesenNesDB.txt
8>C:\code\mesen\UI\Dependencies\Internal\CheatDb.Nes.json
8>C:\code\mesen\UI\Dependencies\Internal\CheatDb.Snes.json
8>C:\code\mesen\UI\Dependencies\Satellaview\BSX0120-0.bin
8>C:\code\mesen\UI\Dependencies\Satellaview\BSX0121-0.bin
8>C:\code\mesen\UI\Dependencies\Satellaview\BSX0122-0.bin
8>C:\code\mesen\UI\Dependencies\Satellaview\BSX0123-0.bin
8>C:\code\mesen\UI\Dependencies\Satellaview\BSX0124-0.bin
8>8 File(s) copied
8>        1 file(s) copied.
8>        1 file(s) copied.
8>        1 file(s) copied.
8>Exception calling "GetFiles" with "0" argument(s): "The file cannot be accessed by the system.
8>"
8>At C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerShell.Archive\1.2.5\Microsoft.PowerShell.Archive.psm1:706
8>char:13
8>+             $files = $currentContent.GetFiles()
8>+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8>    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
8>    + FullyQualifiedErrorId : IOException
8>
8>The system cannot find the file specified.
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: The command "cd C:\code\mesen\bin\win-x64\Release\
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: rd Dependencies /s /q
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: md Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: xcopy /s C:\code\mesen\UI\Dependencies\* Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: copy libHarfBuzzSharp.dll Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: copy libSkiaSharp.dll Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: copy MesenCore.dll Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: cd Dependencies
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: del ..\Dependencies.zip
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: powershell Compress-Archive -Path * -DestinationPath '..\Dependencies.zip' -Force
8>C:\code\mesen\UI\UI.csproj(654,5): error MSB3073: copy ..\Dependencies.zip C:\code\mesen\UI\" exited with code 1.

Have you ever seen this?

Potential Cause

I think this may be caused by my computer getting confused about the file path for the final Dependencies.zip zip file. It claims it is not able to find that file.
I am using Visual Studio 2022 Community, Version 17.14.23, doing a Release x64 build.

I'm not sure if this is an issue with my setup or if I did something wrong. My steps were:

  1. git clone the mesen repo to a local folder
  2. Open mesen.sln with Visual Studio 2022
  3. Select Release and x64 build config
  4. Click on Build -> Build Solution

My guess is that this is some difference between system environment variables and powershell's behaviour with paths, or what folders are included in paths.

Fix - Use the full path

I found that if I change the build script to use the full path for the zip file, then the build succeeds.
I went into the PreBuildWindows command and added a batch file %~f path expansion for the file path.
The build then succeeds just fine.

So I wanted to offer this patch to use the full file path.

Move build steps into batch file

To make viewing and maintaining the build steps a bit easier for humans, I took the liberty of copying the PreBuildWindows commands into a batch file.
This would let anyone view all of the steps in one place, e.g. inside a regular Visual Studio editor window, and be able to use regular newlines for spacing, instead of having to edit everything inside a Visual Studio properties window, or use the special 
 characters for newlines.

Thank you for your time.

move build steps out of the `.csproj` file and into a separate `.bat` file.
this should make it easier to read and edit.
you can use newlines

no behaviour changes
expand path for `Dependencies.zip` with `~f` batch syntax
ensures that powershell can always find the file
@culix-7 culix-7 changed the title Windows build - Use batch file and full path 2. Windows build - Use batch file and full path Jan 9, 2026
@culix-7 culix-7 marked this pull request as draft January 9, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant