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

推荐订阅源

B
Blog
V
Vulnerabilities – Threatpost
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
Latest news
Latest news
博客园 - 三生石上(FineUI控件)
美团技术团队
aimingoo的专栏
aimingoo的专栏
Google Online Security Blog
Google Online Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Threatpost
Y
Y Combinator Blog
T
Tailwind CSS Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
小众软件
小众软件
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tenable Blog
W
WeLiveSecurity
L
LINUX DO - 热门话题
D
Docker
Cyberwarzone
Cyberwarzone
量子位
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Full Disclosure
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
T
The Exploit Database - CXSecurity.com
Engineering at Meta
Engineering at Meta
O
OpenAI News
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
IT之家
IT之家
S
Secure Thoughts
MongoDB | Blog
MongoDB | Blog
L
Lohrmann on Cybersecurity
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News

博客园 - 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 构建) [备忘] 解决 rzc discover exited with code -2147450730 问题 “此 Url 可用于服务器 token 签名校验”提示 在开发环境内网穿透测试微信公众号 1个类,2个方法,3句代码,完成微信公众号开发的极简流程 [重要更新]微信小程序登录、用户信息相关接口调整:使用 wx.getUserProfile 取代 wx.getUserInfo [备忘]使用 .NET Core 模板生成时,在 .csproj 文件中使用条件编译的注意点 WeChatSampleBuilder V2.0 使用教程(网页版+桌面版) SCF(SenparcCoreFramework) 系列教程(一):项目介绍及快速搭建
[备忘]处理错误:Your project does not reference ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "TargetFrameworks" ...
SZW · 2021-02-08 · via 博客园 - SZW

错误信息:

Your project does not reference ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.

其中一种可能是同一个项目目录,被 .NET Framework 和 .NET Core 两个不同的解决方案引用,导致 obj 内的信息混乱。

解决方案一: 不要同时打开两个具有共享项目文件夹的解决方案,并且注意切换的时候删除 obj 和 bin 文件夹。

解决方案二:添加以下代码到 .NET Framework 的项目文件(.csproj)中:

<Project>
  ...
  <PropertyGroup>
    <BaseOutputPath>$(MSBuildProjectDirectory)/out/$(MSBuildProjectName)/bin</BaseOutputPath>
    <BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/out/$(MSBuildProjectName)/obj</BaseIntermediateOutputPath>
  </PropertyGroup>
  ...
</Project>

更多讨论参考:https://stackoverflow.com/questions/52833741/your-project-does-not-reference-netframework-version-v4-6-2-framework-add-a

I experienced similar issue, but with v4.7.2. Namely, I kept getting build log message like this:

error : Your project does not reference ".NETFramework,Version=v4.7.2" framework. Add a reference to ".NETFramework,Version=v4.7.2" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.

Despite the fact that it looked similar, none of the above proposed steps worked for me. I kept seeing this message after each build. Nothing seemed to be able to help.

In fact, the problem was related to that, due to migration, I had to put two projects in one folder of code. One of them was targeted at .Net Core, another at .Net Framework, both referenced same .Net Standard libraries. Apparently, they share the same obj folder where Core projects put project.assets.json file. Actually, exactly this file interferres with the Framework project preventing its normal build. Seems even if you performed Migrate from packages.config to PackageReference... which was recommended as one of possible solution.

You can try to fix the issue by putting the following snippet into your Framework project file:

<Project>
  ...
  <PropertyGroup>
    <BaseOutputPath>$(MSBuildProjectDirectory)/out/$(MSBuildProjectName)/bin</BaseOutputPath>
    <BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/out/$(MSBuildProjectName)/obj</BaseIntermediateOutputPath>
  </PropertyGroup>
  ...
</Project>

It immediately worked for me, it was only later when I attentively read why we need it and why it works. I unexpectedly found it in part 2 of Migrating a Sample WPF App to .NET Core 3 under Making sure the .NET Framework project still builds section. BaseOutputPath and BaseIntermediateOutputPath msbuild variables can be found there, not sure if they are documented well anywhere.