Nuget Package runs into namespace not found
Anush
0
Reputation points
I have a .NET Android Java Binding Library which has the following specifications
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Configurations>Release</Configurations>
<PackageId>CleverTap.DotNet.Android.Binding</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Description>The Clevertap DOTNET Android Binding for Mobile Customer Engagement and Analytics solutions</Description>
<Authors>CleverTap</Authors>
<PackageProjectUrl>https://github.com/CleverTap/clevertap-xamarin</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
I packed this library into a Nuget package.
When I add this package to a .NET android application with following specs, I run into namespace not found error
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationId>com.companyname.androiddemo2</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CleverTap.DotNet.Android.Binding" Version="2.0.0" />
</ItemGroup>
</Project>
I then added the Clevertap android dependency as an Assembly Reference (using .dll file) which resolved the above error. Following this I removed the assembly reference and then added the Nuget package again and the issue magically went away forever. Seems like some caching issue?
Steps to reproduce
- Create a new .NET Android Project
- Add CleverTap.DotNet.Android.Binding using nuget
- Add
using Com.Clevertap.Android.Sdk
inMainActivity.cs
- Observe the build error
VS Studio version -> Visual Studio for MAC (17.6.10)
Sign in to answer