Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
846 views
in Technique[技术] by (71.8m points)

xamarin - Xamarin.Forms上一个全新的项目错误?(Xamarin.Forms errors on a brand new project?)

I'm in VS 2017 v. 15.7.2.

(我在VS 2017 v.15.7.2中。)

I had a fully-working Xamarin.Forms project until about a week or two ago.

(大约一两个星期之前,我有一个可以正常工作的Xamarin.Forms项目。)

I believe there was a VS upgrade from 15.6 and since then, I receive inexplicable errors, even out-of-the-box upon creating a new project, before compilation or doing anything.

(我相信从15.6开始对VS进行了升级,从那时起,我收到了莫名其妙的错误,甚至在创建新项目,编译或执行任何操作之前即开箱即用。)

I cannot put the code in a block quote because the errors won't show, so here is the image:

(我无法将代码放在块引号中,因为不会显示错误,因此图像如下:)

代码图片

When I create a Xamarin.Forms project, I get this (scores of errors).

(当我创建Xamarin.Forms项目时,我得到了(错误分数)。)

The detailed error reads:

(详细错误为:)

Error CS0518 Predefined type 'System.Void' is not defined or imported XamarinTest2 C:...\XamarinTest2\XamarinTest2\XamarinTest2\App.xaml.cs 5 Active

(错误CS0518未定义预定义类型'System.Void'或已导入XamarinTest2 C:... \ XamarinTest2 \ XamarinTest2 \ XamarinTest2 \ App.xaml.cs 5有效)

I can see the "NETStandard.Library" package in Nuget "installed" section shows "2.0.3" yet my common Xamarin.Forms project shows "2.0.1" and the drop-down of versions shows anything else is "blocked by project".

(我可以在Nuget的“已安装”部分中看到“ NETStandard.Library”包显示为“ 2.0.3”,而我的普通Xamarin.Forms项目显示为“ 2.0.1”,而版本下拉列表显示的其他任何内容均“被项目阻止了” ”。)

The other 3 projects, "Android", "iOS", and "UWP" will let me choose and install "2.0.3".

(其他三个项目“ Android”,“ iOS”和“ UWP”将让我选择并安装“ 2.0.3”。)

I tried that once and then got a message about "mixed versions".

(我尝试过一次,然后收到有关“混合版本”的消息。)

At this point, I do believe the issue I'm seeing is related to this "NETStandard" package.

(在这一点上,我确实相信我看到的问题与此“ NETStandard”软件包有关。)

Not if it would help, but I cannot figure out how to make a brand new project load/use/install "2.0.3" instead of "2.0.1".

(如果这样做没有帮助,但我无法弄清楚如何使全新的项目加载/使用/安装“ 2.0.3”而不是“ 2.0.1”。)

Anyone else experiencing bizarre behavior/errors since the most recent VS update?

(自从最近的VS更新以来,还有其他人遇到过奇怪的行为/错误吗?)

  ask by Donna translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had this problem like you and i solved this problem by add 2 package in package source.

(我遇到了像您这样的问题,并通过在软件包源代码中添加2个软件包解决了该问题。)

In Visual Studio go to Tools -> NuGet Package Manager -> Package Manager Settings.

(在Visual Studio中,转到“工具”->“ NuGet程序包管理器”->“程序包管理器设置”。)

Here select the Package Sources tab in the tree on the left.

(在这里,选择左侧树中的Package Sources选项卡。)

You should see the following:

(您应该看到以下内容:)

enter image description here (在此处输入图片说明)

  • Name: nuget.org

    (名称: nuget.org)

  • Source: https://api.nuget.org/v3/index.json

    (资料来源: https://api.nuget.org/v3/index.json : https://api.nuget.org/v3/index.json)

  • Name: LiveReload

    (名称: LiveReload)

  • Source: https://nugetized.blob.core.windows.net/Live-reload/index.json

    (来源: https://nugetized.blob.core.windows.net/Live-reload/index.json : https://nugetized.blob.core.windows.net/Live-reload/index.json)



与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...