-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Version Used:
VS2019 16.11.5
Steps to Reproduce:
- Save follow content to
asdf.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net48;net5.0</TargetFrameworks> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <AssemblyName Condition="'$(TargetFramework)'=='net48'">A.Net48</AssemblyName> <AssemblyName Condition="'$(TargetFramework)'=='net5.0'">A.Net50</AssemblyName> </PropertyGroup> </Project>
- Open this project with VS2019
- Build it, you'll got error:
已启动生成… 1>------ 已启动生成: 项目: asdf, 配置: Debug Any CPU ------ 未能还原 C:\Users\Administrator\Desktop\新建文件夹\asdf.csproj (用时 5 ms)。 NuGet 包还原失败。请查看“错误列表”窗口了解详细警告和错误。 1>C:\Program Files\dotnet\sdk\5.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: 资产文件“C:\Users\Administrator\Desktop\新建文件夹\obj\project.assets.json”没有“net48”的目标。确保已运行还原,且“net48”已包含在项目的 TargetFrameworks 中。 1>已完成生成项目“asdf.csproj”的操作 - 失败。 1>C:\Program Files\dotnet\sdk\5.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: 资产文件“C:\Users\Administrator\Desktop\新建文件夹\obj\project.assets.json”没有“net5.0”的目标。确保已运行还原,且“net5.0”已包含在项目的 TargetFrameworks 中。 1>已完成生成项目“asdf.csproj”的操作 - 失败。 ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
Expected Behavior:
Build success and the condition of AssemblyName work.
Actual Behavior:
Build failed.