Thursday 11 December 2014

Never close down Visual Studio when designing RDLC Reports


One thing I often see when I see other people designing RDLC Reports is that they almost have the Report Dataset Designer maximized in NAV Object Designer. Nothing wrong with that at all, but when they are designing RDLC reports in Visual Studio and hit ESC in NAV to run the report they always get this message in NAV
“The report layout is currently open in the report designer. You must close the report designer window before closing the report object.”
image
The reason for this message is that NAV team is protecting you from closing down the Report Dataset Designer and their by loosing the connection to the report.rdlc file currently being designed. This protection was introduced in NAV 2009 SP1, since NAV 2009 RTM version you could open multiple versions of Visual Studio and then potential loosing a lot of work done in Visual Studio before importing it back to NAV.
So now the problem comes, because what I then see people doing are navigating to Visual Studio and closing down Visual Studio. To me this is fine if they know the report is completely done, but very often they are still developing the report. If you also do this, I suggest that you do not close down Visual Studio, since Visual Studio has a great feature called “Undo”. Often when designing RDLC reports you make a change that you want to verify and if you have closed Visual Studio you have lost the possibility to revert to an earlier version. I know many of you guys are not used to have this possibility, since we in NAV do not have this possibility. BTW, this would be great if we had this possibility in NAV, Microsoft please make this happen :-) Undoing things is much faster then undevelop things. And you do not need to close the Report Dataset Designer window to run the report in NAV, just hit CTRL+R or if you are a mouse person select “File / Run”
But if you keep Visual Studio open, how do you get your changes back into NAV?
You have 2 options:
Option 1. Save the changes in Visual Studio (CTRL+S)
or
Option 2. Build the solution in Visual Studio
Building the solution really only verifies that the XML in RDLC file is in a well formed according to rules for RDL. Notice You can build with all these options, all doing exactly the same in our scenario:
  • Build Solution(Notice that I change the shortcut to F11 :-) )
  • Rebuild Solution
  • Build Web Site
  • Rebuild Web Site
image
I prefer option no. 2 since if I have done anything wrong I get the warning in Visual Studio and do not need to take a round trip to NAV. But also notice that when using option 2, you sometimes can no warning in Visual Studio, but a warning in NAV. Why is that? Well Visual Studio is using their own compiler while NAV is using Report Viewer to verify the RDLC. There really should not be a different but sometimes you will see that everything just compiles fine in VS, and when you move to NAV you get errors, a bit strange that this is happening, but it is of course 2 different verifications so eventually they will be different, unfortunately.
Also when using option no. 2, you sometimes also get in a scenario that you can only save a new version of Report.rdlc:
image
Again why is that? Well simple, end this task in Task Manager, “Microsoft.VisualStudio.Web.Host.exe”, this process sometimes places a lock on the Report.rdlc file you are currently designing and when you try to save it, you cannot since it is locked by the “Microsoft.VisualStudio.Web.Host.exe” and you are presented with the Save As dialog. Quite a pain if you don’t know that you can just end the “Microsoft.VisualStudio.Web.Host.exe” task in Task Manager.
image
But I have gotten used to this and keeping Visual Studio open all the time, until I’m completely done, I can always undo the changes that I made and I can easily go 10-40 steps back if I have gone down a path I shouldn’t have.
Warning! In Visual Studio 2010(NAV 2013) and Visual Studio 2012 / 2013 (NAV 2013 R2) this works fine, but in Visual Studio 2008 (NAV 2009) you seem to be able only to undo 10 steps back, but really you should not design RDLC reports in NAV 2009 since this is using RDLC 2005 which is pretty much a beta version in my eyes. RDLC 2008 and RDLC 2010 are much more mature. We though still miss the possibility to have the Page No. in the body of our reports for RDLC to really grow up and be an adult Report Designer. Microsoft, will we ever be able to have the Page No. in the body of our reports? Would solve majority of the problems I have with RDLC Reports

No comments:

Post a Comment

Microsoft Dynamics NAV 2015 – Simplified Microsoft Dynamics NAV 2015 is much more simpler and easier for the end users to work more ef...