gpt4 book ai didi

c# - NuGet 包异步 CTP(版本 3,非官方)等待和异步编译错误

转载 作者:行者123 更新时间:2023-11-30 21:03:49 25 4
gpt4 key购买 nike

我正在使用 VS2010 并使用 NuGet 安装 Async CTP (Version 3, Unofficial) .然后我复制了一些示例代码:

using System.Threading.Tasks;

namespace ConsoleApplication5AsyncCtp
{
internal class Program
{
private static void Main(string[] args)
{
}

public async Task<int> GetValue()
{
await TaskEx.Delay(100);
return 13; // Return type is "int", not "Task<int>"
}
}
}

ReSharper 在使用 asyncawait 时没有给出任何错误(它在我安装包之前确实显示了错误),所以它看起来很有希望。但是当我构建项目时,出现了一些意料之外的语法错误。

Program.cs(15,32): error CS1003: Syntax error, '(' expected
Program.cs(15,40): error CS1001: Identifier expected
Program.cs(17,32): error CS1031: Type expected
Program.cs(21,1): error CS1022: Type or namespace definition, or end-of-file expected

通过 NuGet 添加异步 CTP(版本 3,非官方)是否不足以实际编译代码?

我必须承认我并不清楚我在这里做什么,只是想让一些演示代码起作用。演示解决方案通过 NuGet 自动安装 Async CTP,似乎表明我无需执行更多操作。

最佳答案

来自NuGet page :

AsyncCtpLibrary.dll from Visual Studio Async CTP Samples folder

换句话说,它似乎只是支持库,而不是编译器。

我建议您只安装 .NET 4.5 - 足以从命令行运行 - 或者安装 Visual Studio 2012 的某个版本。CTP 中存在各种错误 - 使用完整版本要好得多。

关于c# - NuGet 包异步 CTP(版本 3,非官方)等待和异步编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12691389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com