2015 年 Visual Studio 无法加载 CS 项目
Unable to load CS project in Visual Studio 2015
我已经从 Github 下载了 NetTopologySuite。我无法在我的 Visual Studio 2015 IDE.
中加载它
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite\NetTopologySuite.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite\NetTopologySuite.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Samples.Console\NetTopologySuite.Samples.Console.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Samples.Console\NetTopologySuite.Samples.Console.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.TestRunner\NetTopologySuite.TestRunner.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.TestRunner\NetTopologySuite.TestRunner.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.TestRunner.Console\NetTopologySuite.TestRunner.Console.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.TestRunner.Console\NetTopologySuite.TestRunner.Console.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.Vivid.XUnit\NetTopologySuite.Tests.Vivid.XUnit.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.Vivid.XUnit\NetTopologySuite.Tests.Vivid.XUnit.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.NUnit\NetTopologySuite.Tests.NUnit.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.NUnit\NetTopologySuite.Tests.NUnit.csproj
C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.Lab\NetTopologySuite.Lab.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS
Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.Lab\NetTopologySuite.Lab.csproj
然后我尝试 NetTopologySuite.csproj 仅删除所有其他文件夹。
因此,我将文件更改为以下内容:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<NoWarn>659,168,1587</NoWarn>
<EnableApiCompat>true</EnableApiCompat>
</PropertyGroup>
<PropertyGroup Label="Assembly Info">
<AssemblyTitle>NetTopologySuite</AssemblyTitle>
<Description>A .NET library for GIS operations, direct porting of JTS Topology Suite $(JTSCompatibilityLevel) library</Description>
</PropertyGroup>
<PropertyGroup Label="NuGet Package Info">
<PackageId>NetTopologySuite</PackageId>
<Title>NTS - Topology Suite</Title>
<Authors>NetTopologySuite - Team</Authors>
<Owners>NetTopologySuite - Team</Owners>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Description>The NTS Topology Suite is an API for modelling and manipulating 2-dimensional linear geometry. It provides numerous geometric predicates and functions. NTS conforms to the Simple Features Specification.</Description>
<PackageTags>NTS;Topology;OGC;SFS</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<ItemGroup Condition=" '$(EnableApiCompat)' == 'true' ">
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.20162.3" PrivateAssets="All" />
<PackageDownload Include="NetTopologySuite" Version="[$(NtsMajorVersion).0.0]" PrivateAssets="All" />
<ResolvedMatchingContract Include="$(NugetPackageRoot)nettopologysuite$(NtsMajorVersion).0.0\lib\netstandard2.0\NetTopologySuite.dll" />
</ItemGroup>
</Project>
所以,它不起作用。
我该如何解决这个问题?
Unable to load CS project in Visual Studio 2015
您的项目似乎是一个新的sdk格式项目(Net Core and Net Standard)。
它使用<Project Sdk="Microsoft.NET.Sdk">
而不是传统的项目风格:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
并且VS2015不支持新的sdk风格工程
由于VS2017,Microsoft发布了新的sdk风格项目(net core
和net standard
)。可以参考this document.
=============
还有,你修改的也是new sdk format格式(Microsoft.NET.Sdk
),你写错了
Net Standard 项目不能使用旧样式格式:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
解决方案
所以你应该下载使用VS2017或VS2019.
另外,使用vs installer安装时,请确保已安装Net Core workload:
检查两者。
在我这边,我可以从github.
打开项目
我已经从 Github 下载了 NetTopologySuite。我无法在我的 Visual Studio 2015 IDE.
中加载它C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite\NetTopologySuite.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite\NetTopologySuite.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Samples.Console\NetTopologySuite.Samples.Console.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Samples.Console\NetTopologySuite.Samples.Console.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.TestRunner\NetTopologySuite.TestRunner.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.TestRunner\NetTopologySuite.TestRunner.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.TestRunner.Console\NetTopologySuite.TestRunner.Console.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.TestRunner.Console\NetTopologySuite.TestRunner.Console.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.Vivid.XUnit\NetTopologySuite.Tests.Vivid.XUnit.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.Vivid.XUnit\NetTopologySuite.Tests.Vivid.XUnit.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.NUnit\NetTopologySuite.Tests.NUnit.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\test\NetTopologySuite.Tests.NUnit\NetTopologySuite.Tests.NUnit.csproj
C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.Lab\NetTopologySuite.Lab.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\pc\Desktop\GIS Suite\NetTopologySuite-develop\NetTopologySuite-develop\src\NetTopologySuite.Lab\NetTopologySuite.Lab.csproj
然后我尝试 NetTopologySuite.csproj 仅删除所有其他文件夹。
因此,我将文件更改为以下内容:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<NoWarn>659,168,1587</NoWarn>
<EnableApiCompat>true</EnableApiCompat>
</PropertyGroup>
<PropertyGroup Label="Assembly Info">
<AssemblyTitle>NetTopologySuite</AssemblyTitle>
<Description>A .NET library for GIS operations, direct porting of JTS Topology Suite $(JTSCompatibilityLevel) library</Description>
</PropertyGroup>
<PropertyGroup Label="NuGet Package Info">
<PackageId>NetTopologySuite</PackageId>
<Title>NTS - Topology Suite</Title>
<Authors>NetTopologySuite - Team</Authors>
<Owners>NetTopologySuite - Team</Owners>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Description>The NTS Topology Suite is an API for modelling and manipulating 2-dimensional linear geometry. It provides numerous geometric predicates and functions. NTS conforms to the Simple Features Specification.</Description>
<PackageTags>NTS;Topology;OGC;SFS</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<ItemGroup Condition=" '$(EnableApiCompat)' == 'true' ">
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.20162.3" PrivateAssets="All" />
<PackageDownload Include="NetTopologySuite" Version="[$(NtsMajorVersion).0.0]" PrivateAssets="All" />
<ResolvedMatchingContract Include="$(NugetPackageRoot)nettopologysuite$(NtsMajorVersion).0.0\lib\netstandard2.0\NetTopologySuite.dll" />
</ItemGroup>
</Project>
所以,它不起作用。
我该如何解决这个问题?
Unable to load CS project in Visual Studio 2015
您的项目似乎是一个新的sdk格式项目(Net Core and Net Standard)。
它使用<Project Sdk="Microsoft.NET.Sdk">
而不是传统的项目风格:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
并且VS2015不支持新的sdk风格工程
由于VS2017,Microsoft发布了新的sdk风格项目(net core
和net standard
)。可以参考this document.
=============
还有,你修改的也是new sdk format格式(Microsoft.NET.Sdk
),你写错了
Net Standard 项目不能使用旧样式格式:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
解决方案
所以你应该下载使用VS2017或VS2019.
另外,使用vs installer安装时,请确保已安装Net Core workload:
检查两者。
在我这边,我可以从github.
打开项目