How to fix The type or namespace name 'Stimulsoft' could not be found in C#

Mojtaba_Hakim 281 Reputation points
2021-09-04T09:25:45.52+00:00

I'm using C# WPF in Visual Studio 2019 with these :

.NetFramework 4.7

Windows Server 2012

Stimulsoft

When I run this line of code when it reaches the report.Render() that will show this error :

XAML:

<Window  
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
        xmlns:local="clr-namespace:WpfApp10"  
        xmlns:wpfViewer="schemas-stimulsoft-com:wpf-viewer" x:Class="WpfApp10.MainWindow"  
        mc:Ignorable="d"  
        Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">  
    <Grid>  
  
        <wpfViewer:StiWpfViewerControl Name="rptviewer1" HorizontalAlignment="Left" Height="378" Margin="10,10,0,0" VerticalAlignment="Top" Width="772"/>  
  
    </Grid>  
</Window>  

CSharp Code :

 using Stimulsoft.Report;  
 using System.Windows;  
  
namespace WpfApp10  
{  
    /// <summary>  
    /// Interaction logic for MainWindow.xaml  
    /// </summary>  
    public partial class MainWindow : Window  
    {  
        public MainWindow()  
        {  
            InitializeComponent();  
        }  
  
        private void Window_Loaded(object sender, RoutedEventArgs e)  
        {  
            var report = new StiReport();  
            report.Load(@"D:\Myreport1.mrt");  
            report.Render();  
            rptviewer1.Report = report;  
        }  
    }  
}  

Error : CS0246: The type or namespace name 'Stimulsoft' could not be found

129299-123.png

I Tried These :

  1. Changing Net Framework
  2. Clean And Rebuild Solution
  3. Delete And add Reference again into

Please Help

Update :
The problem is

Coustra.Fody

NuGet I uninstalled that and stimulsoft run successfully !
But I need Fody for publish single exe of my whole project
How to do this ?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,627 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 83,106 Reputation points
    2021-09-04T11:26:02.627+00:00

    Have you installed the right package : Stimulsoft.Reports.Wpf

    I did this simple test :

    using Stimulsoft.Report;  
    

    then

    var report = new StiReport();  
    report.Load(@"E:\Sources\WPF_Stimulsoft\SimpleList.mrt");  
    report.Render();  
    report.ShowWithWpf();  
    

    and I get :

    129239-stireport.jpg