dotnet add package SimpleHelpers.FileEncoding
dotnet run
it shows:
C:\Users\user\Downloads\c2\Program.cs(1,7): Error CS0246: The type or namespace name 'SimpleHelpers' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\user\Downloads\c2\c2.csproj]
Program.cs:
using SimpleHelpers.FileEncoding;
namespace c2;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var encoding = FileEncoding.DetectFileEncoding (@"D:\b\big5\LanTingJiXu_big5.txt");
}
}
c2.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SimpleHelpers.FileEncoding" Version="1.4.0" />
</ItemGroup>
</Project>
update the error message.
CodePudding user response:
It looks like this package was authored to use the content
folder with a .cs.pp file transform that were previously rendered and copied to the project folder for projects using packages.config
to reference NuGet packages.
This is no longer supported for SDK-style projects which use PackageReference
. The package author would need to switch to (or add) contentFiles
to support PackageReference
or create a pre-built binary (.dll
file).