惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
B
Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
小众软件
小众软件
P
Proofpoint News Feed
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
量子位

博客园 - SZW

微信 SDK + Senparc.AI + MCP 打造微信 AI 开发助手(二):在 Cursor、VS Code 等 IDE 中自动编写 微信 SDK + Senparc.AI + MCP 打造微信 AI 开发助手(一):网页版 Senparc.AI 系列教程(二):配置大模型,开始开发应用 Senparc.AI 系列教程(一):概要 Senparc 基础库全面适配 .NET 8.0 Senparc.Weixin SDK 微信平台开发教程(二十四):顺应 GenAI 应用,自动“续航”回复超长文本消息 微信新菜单类型 article_id 设置教程 微信 CLI 工具正式发布 v1.0 微信支付 V3 开发教程(一):初识 Senparc.Weixin.TenPayV3 [备忘]如何备份 VPN 文件 - SZW 动态 WebApi 引擎使用教程(3行代码完成动态 WebApi 构建) “此 Url 可用于服务器 token 签名校验”提示 在开发环境内网穿透测试微信公众号 1个类,2个方法,3句代码,完成微信公众号开发的极简流程 [重要更新]微信小程序登录、用户信息相关接口调整:使用 wx.getUserProfile 取代 wx.getUserInfo [备忘]使用 .NET Core 模板生成时,在 .csproj 文件中使用条件编译的注意点 [备忘]处理错误:Your project does not reference ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "TargetFrameworks" ... WeChatSampleBuilder V2.0 使用教程(网页版+桌面版) SCF(SenparcCoreFramework) 系列教程(一):项目介绍及快速搭建
[备忘] 解决 rzc discover exited with code -2147450730 问题
SZW · 2021-07-25 · via 博客园 - SZW

现象:

  本地可以正常编译和使用,用 Azure DevOps 进行 CI 时出错

重现:

  项目代码:

<Project Sdk="Microsoft.NET.Sdk.Razor">
    <PropertyGroup>
        <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
...

  YAML 配置:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/Senparc.Xncf.WeixinManager.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:

- task: UseDotNet@2
  displayName: 'Use .NET SDK 3.1'
  inputs:
    version: '3.1.x'
    packageType: 'sdk'


- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    command: build
    projects: '**/Senparc.Xncf.WeixinManager.sln'
    arguments: '--configuration Release'

  编译日志记录:

Starting: Build
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.187.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
C:\hostedtoolcache\windows\dotnet\dotnet.exe build D:\a\1\s\src\Senparc.Xncf.WeixinManager.sln "-dl:CentralLogger,\"D:\a\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.187.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"*ForwardingLogger,\"D:\a\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.187.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"" --configuration Release
Microsoft (R) Build Engine version 16.10.2+857e5a733 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj (in 1.12 min).
  Restored D:\a\1\s\src\Senparc.Xncf.WeixinManager.Tests\Senparc.Xncf.WeixinManager.Tests.csproj (in 1.12 min).
##[warning]C:\hostedtoolcache\windows\dotnet\sdk\5.0.302\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets(416,5): Warning RAZORSDK1006: Detected Razor language version downgrade. This is typically caused by a reference to the Microsoft.AspNetCore.Razor.Design package. Consider removing this package reference.
C:\hostedtoolcache\windows\dotnet\sdk\5.0.302\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets(416,5): warning RAZORSDK1006: Detected Razor language version downgrade. This is typically caused by a reference to the Microsoft.AspNetCore.Razor.Design package. Consider removing this package reference. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Models\DatabaseModel\Dto\WeixinUserDto.cs(63,23): Warning CS0108: 'WeixinUserDto.Remark' hides inherited member 'DtoBase.Remark'. Use the new keyword if hiding was intended.
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Models\DatabaseModel\Dto\WeixinUserDto.cs(63,23): warning CS0108: 'WeixinUserDto.Remark' hides inherited member 'DtoBase.Remark'. Use the new keyword if hiding was intended. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Models\DatabaseModel\WeixinUser.cs(71,23): Warning CS0108: 'WeixinUser.Remark' hides inherited member 'EntityBase<int>.Remark'. Use the new keyword if hiding was intended.
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Models\DatabaseModel\WeixinUser.cs(71,23): warning CS0108: 'WeixinUser.Remark' hides inherited member 'EntityBase<int>.Remark'. Use the new keyword if hiding was intended. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Areas\Admin\Pages\WeixinManager\WeixinUser\Index.cshtml.cs(44,42): Warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Areas\Admin\Pages\WeixinManager\WeixinUser\Index.cshtml.cs(44,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Register.cs(189,13): Warning CS0162: Unreachable code detected
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Register.cs(189,13): warning CS0162: Unreachable code detected [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Register.Middleware.cs(83,46): Warning CS0168: The variable 'ex' is declared but never used
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Register.Middleware.cs(83,46): warning CS0168: The variable 'ex' is declared but never used [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]src\Senparc.Xncf.WeixinManager\Areas\Admin\Pages\WeixinManager\WeixinUser\Index.cshtml.cs(28,21): Warning CS0414: The field 'WeixinUser_IndexModel.pageCount' is assigned but its value is never used
D:\a\1\s\src\Senparc.Xncf.WeixinManager\Areas\Admin\Pages\WeixinManager\WeixinUser\Index.cshtml.cs(28,21): warning CS0414: The field 'WeixinUser_IndexModel.pageCount' is assigned but its value is never used [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
##[warning]CSC(0,0): Warning AD0001: Analyzer 'Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
CSC : warning AD0001: Analyzer 'Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]
  It was not possible to find any compatible framework version
  The framework 'Microsoft.NETCore.App', version '2.0.9' was not found.
    - The following frameworks were found:
        5.0.8 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
  
  You can resolve the problem by installing the specified framework and/or SDK.
  
  The specified framework can be found at:
    - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.9&arch=x64&rid=win10-x64
##[error]C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): Error : rzc discover exited with code -2147450730.
C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): error : rzc discover exited with code -2147450730. [D:\a\1\s\src\Senparc.Xncf.WeixinManager\Senparc.Xncf.WeixinManager.csproj]

尝试解决方案:

  1. 项目文件设置添加:<RazorLangVersion>3.0</RazorLangVersion> ,无效,引发其他错误:MSB4044 未给任务“ComputeCssScope”的必需参数“TargetName”赋值。
  2. 修改项目文件配置 Microsoft.NET.Sdk.Razor 为 Microsoft.NET.Sdk,集成后无法读取 Razor 页面
  3. 项目添加引用 <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.1" />,无效

最终解决方案:

  在 .csproj 文件中添加配置:

<AddRazorSupportForMvc>true</AddRazorSupportForMvc>