Appveyor 的 PostSharp 构建错误

PostSharp build error with Appveyor

我正在尝试将我的代码部署到 AppVeyor 上的构建机器,我发现我需要创建一个 postsharp.config 文件,其中包含我的许可证详细信息构建,但出现以下错误:

C:\projects\webapibase\packages\PostSharp.5.0.41\build\PostSharp.targets(314,5): error PS0260: License error. The license xxx is not allowed to be loaded from C:\projects\webapibase\Service\postsharp.config. [C:\projects\webapibase\Service\Service.csproj] C:\projects\webapibase\packages\PostSharp.5.0.41\build\PostSharp.targets(314,5): error PS0242: License error. No valid license key has been installed. Please visit https://www.postsharp.net/purchase to acquire a license of PostSharp. To register a license key, use PostSharp Essentials or start the evaluation period, execute the program

我已经创建了 postsharp.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <License Value="xxxx" />
</Project>

Ps。 VSTS 中的同一项目正常构建(没有文件),可能是 PostSharp 检测到构建机器并忽略许可证检查。

检查此解决方案是否仍然适用于 PostSharp:https://help.appveyor.com/discussions/problems/934-postsharp-free-licences-do-not-work-on-the-new-environment#comment_35059947

已修复,解决方案是在构建之前添加 RegKey:

REG ADD "HKEY_CURRENT_USER\Software\SharpCrafters\PostSharp 3" /v LicenseKey /t REG_SZ /d <your_license>