I have migrated a .NET Framework 4.8 WinForms project to .NET 8. I am using Mapsui 5.0.0-rc.2. The project fails to compile with errors like CS0246: The type or namespace name 'Shapefile' could not be found, even though the package is referenced.
Symptoms:
using statements for Mapsui.Tiling.Layers and Mapsui.Nts.Providers.Shapefile are "dimmed gray" in Visual Studio, as if unused.
The compiler cannot find types from those namespaces (e.g., Shapefile, OpenStreetMap, ThemeStyle).
This occurs even in a brand new, clean project on my machine.
Troubleshooting Steps Already Taken (None have worked):
Cleaned and rebuilt the solution multiple times.
Manually deleted all bin and obj folders.
Reinstalled all NuGet packages.
Cleared all NuGet caches using dotnet nuget locals all --clear.
Completely replaced the old .csproj file with a new, clean SDK-style project file for .NET 8.
Deleted the hidden .vs solution folder.
Performed a full "Repair" of my Visual Studio installation and rebooted.
Moved <Compile Update> tags for my Forms from a .csproj.user file to the main .csproj file.
Here is my current, clean .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>ReverewoodRadar</RootNamespace>
<AssemblyName>ReverewoodRadar</AssemblyName>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mapsui.WindowsForms" Version="5.0.0-rc.2" />
<PackageReference Include="Mapsui.Nts" Version="5.0.0-rc.2" />
<PackageReference Include="Mapsui.Tiling" Version="5.0.0-rc.2" />
<PackageReference Include="Mapsui.Rendering.Skia" Version="5.0.0-rc.2" />
<PackageReference Include="NetTopologySuite.IO.Esri.Shapefile" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLibrary\SharedLibrary.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Level3Parser.cs" />
<Compile Remove="Level3Radar.cs" />
<Compile Remove="Radars.cs" />
<Compile Remove="USGSMapProvider.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="MainForm.cs.backup" />
</ItemGroup>
<ItemGroup>
<None Update="ShapeFiles\cb_2023_us_county_500k.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ShapeFiles\cb_2023_us_state_500k.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ShapeFiles\cities.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ShapeFiles\tl_2024_us_primaryroads.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="BufferedPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Options.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="PublishingDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="WarningsWindow.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>