问题描述
我正在尝试在 vs 2019(v16.10) 中使用 .netstandard 2.0 项目编译解决方案 我收到此错误消息(我使用 PostSharp):
错误 MSB4064 从程序集加载的“PrepareForReadyToruncompilation”任务不支持“NETCoreSdkRuntimeIdentifier”参数:Microsoft.NET.Build.Tasks,Version=5.0.4.26711,Culture=neutral,PublicKeyToken=31bf3856ad364e35 \Program Files\dotnet\sdk\5.0.300\Sdks\Microsoft.NET.Sdk\tools\net5.0\Microsoft.NET.Build.Tasks.dll。验证该参数是否存在于任务中,指向正确的程序集,并且它是可设置的公共实例属性。 PROJECT.ASSEMBLY.NAME C:\ProgramData\PostSharp\CrossGenPaths\sdk5.0.300-netcoreapp5.0-r5.0.6-win-x64\CrossGen.proj
有人知道吗?
解决方法
作为 @Daniel Balas 的回答,我将其添加到 .csproj 文件中:
let obj = {
val: 1
};
let arr = [];
for (let i = 0; i < 5; ++i) {
arr.push(obj);
}
// Every item will have val: 1
console.log(JSON.stringify(arr));
// However,if we change obj.val to 2...
obj.val = 2;
// Because the array stores references to obj
// and not copies of obj when obj was pushed into
// the array,the val attribute will have updated
// for every object in the array,despite the fact that
// we haven't directly changed the array at all!
console.log(JSON.stringify(arr));
它有效! 谢谢!