0

我在Visual Studio 2017中有一個初學者ASP.NET Core項目,並且我在HelloWorld的腳手架步驟。腳手架不工作,我的第一臺計算機上進行測試,然後在第二個......ASP.NET核心腳手架無法在VS 2017中工作

當我嘗試生成的觀點 enter image description here 控制器,它給人的第一臺機器上出現以下錯誤:

Microsoft Visual Studio


Error

There was an error running the selected code generator:

'Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)'


OK

在第二機器:

Microsoft Visual Studio


Error

There was an error running the selected code generator:

'Error: assembly specified in the dependencies manifest was not found -- package: 'microsoft.applicationinsights.aspnetcore', version: '2.1.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll''


OK

回答

1

清除本地的NuGet緩存與從控制檯命令:

dotnet nuget locals all --clear

恢復所有的軟件包

安裝(或更新)NuGet包Microsoft.CodeAnalysis.CSharp.Workspaces版本2.0.0(或更高版本)編輯:接縫2.3.0版本和2.3.1引起一些問題。所以最多堅持2.2.0,直到MS解決這個問題(https://github.com/dotnet/roslyn/issues/20873)。

再次還原所有包並嘗試腳手架。

這對我有用。

確保你已經正確在你的項目中引用這些軟件包:

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" />

<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />

我的項目使用Asp.Net Core 1.1.2VS2017 Community

+0

我所做的是修復VS-2017的安裝(企業版)......現在腳手架工作。 – Serge

+0

我已經試過修復,它沒有改變一件事。 –

相關問題