RouteDebug doesn't work as a NuGet package
bartvanderwalips opened this issue · comments
@haacked, I love your work and your MVC RouteDebugger utility is used a lot, also by me.
However - somewhat strangely - it doesn't quite work as a NuGet package for me. I have only gotten it to work by manually downloading the zipped .dll, adding that to the /bin
and then adding a reference in my project in Visual Studio. But then of course when I delete my bin
and obj
from my project - for instance to fix some obnoxious error in Visual studio when cleaning is not enough - I have to redo this progress.
So I WOULD like to have it as a NuGet packages so it can 'survive a clean'.
For the RouteDebug
package I get a simple 'does not exist' compile error:
The type or namespace name 'RouteDebugger' does not exist in the namespace 'RouteDebug' (are you missing an assembly reference?)
This happens on the line
RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
that I added in theApplication_Start()
method ofGlobal.asax.cs
I have tried removing and re-adding the package as well, but that doesn't help. I am currently using Visual Studio 2013 (Professional): MVC5 (but had this issue in VS 2010 as well).
Note: I logged this as a general issue before, but am now logging this issue on the RouteMagic repo, so I installed this NuGet package (removed the RouteDebugger package first). This gives me a similar error on the same line:
The name 'RouteDebug' does not exist in the current context
Hi @bartvanderwalips what version of ASP.NET MVC are you running this against. And did you install the latest RouteDebugger package?
Starting with RouteDebugger 2.0, you don't need to add any code to Global.asax.cs in order for it to work. Check out this blog post: http://haacked.com/archive/2011/04/13/routedebugger-2.aspx/
After you install the package into your ASP.NET MVC project (make sure you target the right project), it should just work.
Hello Phil,
Thanks for your time! To answer you question: I'm running MVC5 since a while. Like I stated before. But I had the same issue (The type or namespace name 'RouteDebugger' does not exist...
in MVC 4.0 before I updated. I switched from the RouteDebugger
NuGet package to the RouteMagic
package when you asked me to log a bug on this repo. Version 1.2 (NuGet indicates this as the latest). This had the same issue.
If you're saying the line in global.asax
isn't necessary anymore, then that might solve the issue. Since I can simply remove the line that is not compiling. My issue is then more that I was following online instructions that are out of date :).
However if I remove this line from global.asax
routedebugging is also not working. I DO have this in my appSettings:
<add key="RouteDebugger:Enabled" value="true" />
I don't have time to investigate it further right now. Will do that when I need to route debug again 😄.
If you can take out any proprietary code and send me the project, I can look at it.
Thanks! About the whole project is proprietary. But if I simply
- create a new default (c#) MVC5 app, and
- add the
RouteMagic
NuGet package and - the
RouteDebugger:Enabled
appSetting
then I also don't see the expected extra route debugging info at the bottom of the page when running it.
I'm a bit afraid I'm doing something elementary wrong. But if you are still willing to take some time, I cloned your project on GitHub and have added a zip with the solution in it. You can download it here
Note: I'm using Visual Web Express 2013.
Do you want RouteMagic
or RouteDebugger
? The RouteMagic
package contains a set of custom routes that are useful. The RouteDebugger
package contains the route debugger and doesn't require any changes.
I think the confusion is that the source code for these two packages are both in the same GitHub repository, haacked/routemagic.
Sorry for the confusion.
Thanks @haacked!
It is working now 😄 . I switched back to the RouteDebugger
package.
To prevent future confusion perhaps you could add a small mention in your original post that the line in the global.asax
line is no longer necessary in newer versions (just above code sample):
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx/
@bartvanderwalips great! Sorry for the confusion.
To prevent future confusion perhaps you could add a small mention in your original post that the line in the global.asax line is no longer necessary in newer versions (just above code sample):
Want to send me a pull request? On every post, there is an "edit" link (I put here for convenience) that takes you to a markdown editor. When you make a change, it'll send me a pull request.
If you don't have the time, I'll do it. But I love getting contributions. 😄
Thanks! I hadn't noticed the edit link on your blog. Am curious to see how that works. Will do it from my personal GitHub profile.
Yes. You'll have to login to GitHub.com (if you're not alread). It'll fork my repository and give you an in-browser text editor. When you commit it, it'll submit a pull request to me.
@haacked does this work at all with classic web forms?
@ortrails it works with Routing. So if you're using Routing with Web Forms, then yes.