Program.csのMain()の中に、ログ出力前に以下を記載すればReleaseビルドのときにも出力されるようになる。
log4net.Config.XmlConfigurator.Configure();
AnyCPUでビルドして64bitで動作するEXEを32bitで動作するようにするには、以下のコマンドを実行する。
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\CorFlags.exe" 変更したいEXE.exe /32BITREQ+ /Force
実行すると以下のようにコンソールに出力される(変更が完了したかについては表示されないようだ)。
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.8.3928.0
Copyright (c) Microsoft Corporation. All rights reserved.
変換完了後、実際に64bit環境で起動させてみて、タスクマネージャーの詳細タブから、該当のEXEのプロットフォームが「32ビット」となっていれば変更は完了している。
Contact Form 7の画面に以下の記載があったため、移行してみた。
reCAPTCHA をご利用の方へ: Google はすべての reCAPTCHA ユーザーを reCAPTCHA Enterprise に移行させる計画を進めています。これは無料枠を超過した API 呼び出しについて Google から課金されるということです。Contact Form 7 は Cloudflare Turnstile をサポートしており、reCAPTCHA を選択しなければならない理由がある場合を除いて Turnstile の利用を推奨しています。
1.WordPressの管理画面の左側メニューからお問い合わせ→インテグレーションをクリック
2.reCAPTCHAを削除する
3.Cloudflareにログインし以下のようにTurnstileの設定を行う。Site KeyとSecret Keyをメモしておく。

4.WordPressの管理画面の左側メニューからお問い合わせ→インテグレーションに戻り、Turnstileのインテグレーションのセットアップをクリック
5.先ほどメモしたSite KeyとSecret Keyを登録
6.WordPressの管理画面の左側メニューからお問い合わせ→フォームをクリック
7.フォームに [turnstile] を追加する。

8.動作テスト
以下のように表示される。実際に送信できればOK

SQLite+EntityFrameworkの環境にて発生。
System.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions. ---> System.Data.Entity.Core.OptimisticConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.
場所 System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)
場所 System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
場所 System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
場所 System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
場所 System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
場所 System.Data.Entity.Internal.InternalContext.SaveChanges()
あるフォームのイベント発生時にレコード更新する処理を入れていたが、先に閉じたフォームのイベントが残っていて、同時に複数のフォームから同じレコードを更新していたことが原因だった。
今回は、閉じたフォームのイベントが確実に消えるようにしたところ解消された。
WindowsのAPIであるGetShortPathName関数を利用する。
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern int GetShortPathName(string lpszLongPath, StringBuilder lpszShortPath, int cchBuffer);
以下のように呼び出す。
// ※ポイント!
// 長いパスの先頭に「\\?\」をつけないと、短いパスを取得できない
var longPath = @"\\?\C:\Users\a\Desktop\あいうえお\テキストファイル\111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.txt";
var shortPath = new StringBuilder(256);
if (GetShortPathName(longPath, shortPath, shortPath.Capacity) == 0)
{
// 取得失敗
}
else
{
// 取得成功。取得例 \\?\C:\Users\a\Desktop\あいう~1\テキス~1\111111~1.TXT
Console.WriteLine(shortPath);
}
以下の2ファイルは同じフォルダに保存されている前提。
start.batをダブルクリックするだけで、ps1が実行されるようになる。
@echo off rem ps1ファイルをそのまま呼び出せるようにするため、「-ExecutionPolicy Bypass」を指定する powershell -ExecutionPolicy Bypass -File "%~dp0main.ps1" pause
# 現在日時を表示 Write-Host "PowerShellを実行しました! $(Get-Date -Format 'yyyy/MM/dd HH:mm:ss')"
You can easily automate routine computer tasks.
Start EasyReplayWindows and click the “Start Recording” button.
Then operate your computer as you normally would.
After recording is complete, in “AutoPlay Settings”, specify the time and day you want it to run.
The recorded content will now be executed automatically every time.


It’s very easy to use, so please give it a try!
You can use it for free for one month.
Once you have confirmed that it works without any problems, please purchase it from the link below.
*Refunds are not available after purchase. Please check the operation beforehand.
*Automatic payment is made every month. If you wish to cancel the renewal, please contact us by email (it takes several days to process the cancellation, so please contact us earlier than the next renewal date.)