我使用此链接https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/
将我的.netcore 1.1项目迁移到了2.0但是当我执行“dotnet restore -v d”时,我收到以下错误:
Build started 10/23/2017 19:57:01. 1>Project "someproj.csproj" on node 1 (Restore target(s)). 1>Building with tools version "15.0". 1>someproj.csproj(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1. 1>Done Building Project "someproj.csproj" (Restore target(s)) -- FAILED. Build FAILED. "/someproj/someproj.csproj" (Restore target) (1) -> /someproj.csproj(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1,
位置1。
0 Warning(s) 1 Error(s)
以下是dotnet --info
的输出.NET命令行工具(2.0.0)
产品信息:版本:2.0.0提交SHA-1哈希: cdcd1928c9
运行时环境:操作系统名称:Mac OS X操作系统版本:10.12操作系统 平台:Darwin RID:osx.10.12-x64基本路径:
/usr/local/share/dotnet/sdk/2.0.0 /Microsoft .NET核心共享框架主机
版本:2.0.0 Build: e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
这是我的csproj文件
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
<Folder Include="swagger_static\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Serilog" Version="2.4.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="2.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="Dapper" Version="1.50.2" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\recon.curator.common\recon.curator.common.csproj" />
<ProjectReference Include="..\..\..\..\recon.curator.service\recon.curator.service.csproj" />
</ItemGroup>
</Project>
答案 0 :(得分:0)
原来,文件中有一些特殊字符在VSCode中不可见。当我在Vim上打开文件时,它显示了一些不需要的字符....删除那些修复了问题