D:\inetpub\sato>dotnet --info
.NET SDK:
Version: 10.0.101
Commit: fad253f51b
Workload version: 10.0.100-manifests.9f71effe
MSBuild version: 18.0.6+fad253f51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.101\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.1
Architecture: x64
Commit: fad253f51b
.NET SDKs installed:
8.0.416 [C:\Program Files\dotnet\sdk]
10.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
DOTNET_CLI_UI_LANGUAGE [en]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
D:\inetpub\sato>dotnet build
Determining projects to restore...
All projects are up-to-date for restore.
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
Build FAILED.
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:02.61
D:\inetpub\sato>dotnet publish -c Debug
Determining projects to restore...
All projects are up-to-date for restore.
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
Error: Failed to publish project.
Hi, today I got this problem. Would you mind helping to solve this problem?
The project will now be built and published.
D:\inetpub\sato>set DOTNET_CLI_UI_LANGUAGE=en
D:\inetpub\sato>dotnet --info
.NET SDK:
Version: 8.0.416
Commit: f9da71086e
Workload version: 8.0.400-manifests.785fc388
MSBuild version: 17.11.48+02bf66295
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.416\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.22
Architecture: x64
Commit: a2266c728f
.NET SDKs installed:
8.0.416 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
D:\inetpub\sato>dotnet build
Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.416
Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Determining projects to restore...
Restored D:\inetpub\sato\project1.csproj (in 5.38 sec).
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
Build FAILED.
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:15.56
D:\inetpub\sato>dotnet publish -c Debug
Determining projects to restore...
All projects are up-to-date for restore.
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(13,17): error CS0246: The type or namespace name 'iTextSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
D:\inetpub\sato\Models\src\HtmlToPdfBuilder.cs(15,17): error CS0246: The type or namespace name 'StyleSheet' could not be found (are you missing a using directive or an assembly reference?) [D:\inetpub\sato\project1.csproj]
Error: Failed to publish project.
I still have the same error. I already uninstall dotnet 10
Which version of ASP.NET Maker are you using? I assume v2025.
Make sure you have enabled the pdfexport extension.
After enabling the extension, make sure you have generated all files again, especially the .csproj file. After dotnet restore/build, you should see iTextSharp.LGPLv2.Core.dll in the bin folder. Otherwise, you'll get the "The type or namespace name 'iTextSharp' could not be found" error. If you are running your site (e.g. by IIS), stop it first before script generation to make sure the old files can be overwritten, or you should delete all files in your project folder first. After script regeneration, start the site again.