title: The report definition is not valid. Details: The report definition has an invalid target namespace
body: <blockquote>
    <p>The report definition is not valid. Details: The report definition has an invalid target namespace '<a href="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" rel="noreferrer">http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition</a>' which cannot be upgraded.</p>
  </blockquote>
  
  <p>I am using ASP.NET MVC framework. To error comes when I <code>setparameter()</code> call to set the data into rdlc designing report.</p>
  
  <p><code>viewer.LocalReport.DataSources.Add(new ReportDataSource("SaleDataSet", modelList));</code> This line of code executed successfully,and report has been printed.</p>
  
  <p>But at below line,
  <code>viewer.LocalReport.SetParameters(parms);</code>
  error comes.</p>
  
  <p>An error comes during local report processing.
  The report definition has an invalid target namespace.</p>
  
  <pre><code>public ActionResult PrintSaleReport(string saleId)
  {
      try
      {
          Decimal sId = 0;
          if (!string.IsNullOrEmpty(saleId))
          {
              sId = Convert.ToDecimal(saleId);
          }
  
          var saleList = new SaleRepository().GetById(sId);
          List&lt;SalesModel&gt; modelList = new List&lt;SalesModel&gt;();
          foreach (var item in saleList.SaleHistories)
          {
  
              SalesModel obj = new SalesModel();
              obj.StockName = item.Stock.Name;
              obj.saleQuantity = item.Quantity + "";
              obj.SaleHistoryPrice = Math.Round(Convert.ToDecimal(item.SalePrice), 2) + "";
              obj.Expr = Convert.ToDecimal(obj.saleQuantity) * Convert.ToDecimal(obj.SaleHistoryPrice) + "";
              modelList.Add(obj);
          }
          var TotalAmount = Math.Round(Convert.ToDecimal(saleList.TotalBill), 2);
          var discount = Math.Round(Convert.ToDecimal(saleList.Discount), 2);
          var invoiceNumber = DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt");
          var itemCount = saleList.SaleHistories.Count();
  
          ReportParameter[] parms = new ReportParameter[1];
          parms[0] = new ReportParameter("[TotalAmount]", TotalAmount + "");
          //parms[1] = new ReportParameter("[Discount]", discount+"");
          //parms[2] = new ReportParameter("[InvoiceId]", invoiceNumber + "");
          //parms[3] = new ReportParameter("itemCount", itemCount + "");
  
          var viewer = new ReportViewer();
  
          string path = Path.Combine(Server.MapPath("~/Reports"), "SaleReport.rdlc");
          if (System.IO.File.Exists(path))
          {
              viewer.LocalReport.ReportPath = path;
  
          }
          else
          {
              return View("Index");
          }
  
          viewer.LocalReport.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));
          viewer.LocalReport.DataSources.Add(new ReportDataSource("SaleDataSet", modelList));
          viewer.LocalReport.SetParameters(parms);
          string reportType = "PDF";
          string mimeType;
          string encoding;
          string fileNameExtension;
  
          Warning[] warnings;
          string[] streams;
          byte[] renderedBytes;
          //string deviceInfo =
          //    "&lt;DeviceInfo&gt;" +
          //   "&lt;OutputFormat&gt;" + "PDF" + "&lt;/OutputFormat&gt;" +
          //   "&lt;PageWidth&gt; 8.5in&lt;/PageWidth&gt;" +
          //   "&lt;PageHeight&gt; 11in&lt;/PageHeight&gt;" +
          //   "&lt;MarginTop&gt;0.5in&lt;/MarginTop&gt;" +
          //   "&lt;MarginLeft&gt;1in&lt;/MarginLeft&gt;" +
          //   "&lt;MarginRight&gt;1in&lt;/MarginRight&gt;" +
          //   "&lt;MarginBottom&gt;1in&lt;/MarginBottom&gt;" +
          //  "&lt;/DeviceInfo&gt;";
          renderedBytes = viewer.LocalReport.Render(
              reportType,
              null,
              out mimeType,
              out encoding,
              out fileNameExtension,
              out streams,
              out warnings
               );
          return File(renderedBytes, mimeType);
      }
      catch (Exception ex)
      {
          string message = ex.Message;
          string innermesasge = ex.InnerException.Message;
          var moreinnerMsg = ex.InnerException.InnerException;
          throw ex;
      }   
  }
  </code></pre>