简体   繁体   中英

Unable to load CS project in Visual Studio 2015

I have downloaded NetTopologySuite from Github. I am failing to load it in my 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

Then I tried to NetTopologySuite.csproj only by deleting all other folders.

在此处输入图像描述

So, I changed file into the following:

<?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>

在此处输入图像描述

So, it is not working.

How can I resolve this issue?

Unable to load CS project in Visual Studio 2015

Your project seems to be a new sdk format project( Net Core and Net Standard ).

It uses <Project Sdk="Microsoft.NET.Sdk"> rather than the traditional project style:

<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

And VS2015 does not support the new sdk style project.

Since VS2017 , Microsoft Released the new sdk style project( net core and net standard ). You can refer to this document .

=============

Also , what you modified is also new sdk format format( Microsoft.NET.Sdk ) and you wrote it in a mistake.

Net Standard project cannnot use the old style format:

<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Solution

So you should download to use VS2017 or VS2019 .

Also, when you install it by vs installer, you should make sure that you have installed Net Core workload:

Check both of them.

在此处输入图像描述

在此处输入图像描述

In my side , I can open the project from the github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM