【发布时间】:2018-01-28 22:58:26
【问题描述】:
从 ASP.Net Core 1.X 升级到 2.0 (https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/)
我遇到过以下疑惑/问题:
第一:元包
现在
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
我们获得了项目所需的所有参考资料。但是我不知道我是否应该排除Microsoft.VisualStudio.Web的包
我对这些参考有怀疑:
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="2.0.0" />
我看到 metapackage 包含这个:Microsoft.VisualStudio.Web.BrowserLink" Version
我是否应该只排除那个并保留另外两个(CodeGeneration.Design
还有Microsoft.VisualStudio.Web.CodeGenerators.Mvcthere?
第二个:错误
我遇到了各种各样的错误
第一个说metapackage安装的包与aspnetcore2.0不兼容有人遇到过吗?有关如何处理此问题的任何建议?
第二次给出这个错误信息:
“Microsoft”命名空间中不存在“EntityFrameworkCore”命名空间的类型或名称(是否缺少任何程序集引用?)
提前致谢!
决赛
这就是我的 csproj 看起来像 atm 的样子:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
<Compile Remove="wwwroot\lib\kendo-ui-core\**" />
<Content Remove="wwwroot\lib\kendo-ui-core\**" />
<EmbeddedResource Remove="wwwroot\lib\kendo-ui-core\**" />
<None Remove="wwwroot\lib\kendo-ui-core\**" />
</ItemGroup>
<ItemGroup>
<Content Include="wwwroot\css\bootstrap-lumen.css" />
<Content Include="wwwroot\css\bootstrap-sand.css" />
<Content Include="wwwroot\css\bootstrap-sand.min.css" />
<Content Include="wwwroot\js\application-role-index.js" />
<Content Include="wwwroot\js\family-index.js" />
<Content Include="wwwroot\js\jquery-3.2.1.min.js" />
<Content Include="wwwroot\js\modal-action-store.js" />
<Content Include="wwwroot\js\populate-district.js" />
<Content Include="wwwroot\js\store-index.js" />
<Content Include="wwwroot\js\type-index.js" />
<Content Include="wwwroot\js\user-index.js" />
<Content Include="wwwroot\js\jquery.filtertable.min.js" />
<Content Include="wwwroot\js\machine-index.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.v3.Datetimepicker" Version="4.17.45" />
<PackageReference Include="Bootstrap.v3.Datetimepicker.CSS" Version="4.17.45" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="NuGet.CommandLine" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
</Project>
【问题讨论】:
标签: asp.net .net asp.net-mvc