If the Nuget Package Manager is used to add Aspose.Word to a project in Visual Studio 2019 and the selected package management format is “PackageReference” (not “Packages.config”) then the project will build successfully. However if DotNet.exe is used to build the project from the command line (e.g. “dotnet build SolutionName.sln” then the build will fail with the following error message, “error cs0246: The type of namespace name ‘Aspose’ could not be found (are you missing a using directive or an assembly reference?)” To see this behavior simply create a solution with a single project that is a .NET Framework class library. In the Class1.cs file add a using statement, “using Aspose.Word” and then add the following inside the class, “Comment comment = new Comment(null);” Again if you now build the solution inside Visual Studio 2019 it will succeed. But if you build with DotNet.exe via the command line then the build will fail. Incidentally if the selected package management format is “Packages.config” when the Aspose package is added to the project then using DotNet.exe to build will succeeds.
We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-21508. We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for any inconvenience.
Regarding WORDSNET-21508, we have found that this problem is not related to Aspose.Words. Please see the following link. You have to modify your csproj manually to make it work.
There is no way to create such type of project using dotnet from command line.
Please run the command:
dotnet new classlib -h
The target framework for the project.
net5.0 - Target net5.0
netstandard2.1 - Target netstandard2.1
netstandard2.0 - Target netstandard2.0
netcoreapp3.1 - Target netcoreapp3.1
netcoreapp2.1 - Target netcoreapp2.1
Default: net5.0