You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决.NET SDK错误NETSDK1100:设置EnableWindowsTargeting为true

解决NETSDK1100错误:非Windows系统构建Windows目标项目

错误详情

/usr/share/dotnet/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/sec/root/****/*****.Native.csproj]

解决方案

不需要修改SDK目录下的Microsoft.NET.Sdk.FrameworkReferenceResolution.targets文件,直接在你的项目文件(即报错路径中的*****.Native.csproj)里添加配置即可:

  1. 打开该csproj文件
  2. 在<PropertyGroup>节点中加入EnableWindowsTargeting属性并设置为true,示例格式如下:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <!-- 保留项目原有的OutputType、TargetFramework等配置 -->
    <EnableWindowsTargeting>true</EnableWindowsTargeting>
  </PropertyGroup>
</Project>

项目文件中的配置会覆盖SDK的默认参数,添加后重新构建项目即可解决该错误。

内容的提问来源于stack exchange,提问作者prince royce

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 06:59:59