1

First problem :

I am using some externall buisness libraries and they have strange namespace for example System.Web.UI.Page. Cant do nothing about that. Problem occurs in ASP.NET when libraries are loaded everything is fine but problem occurs when displaying pages :

CS0433: The type 'System.Web.SessionState.IRequiresSessionState' exists in both

So basically C# tries to compile page - but dont know which library to use for this type

I found solution with externall alliases but, then there is a problem in designer cause every time i modify page it will break naming( really hard to mantain ) - desginer will switch name from "MyNewExternalAlliase"->"Global", or when adding new ellemnts they will show with global::. It will be really time consuming.

Question :

Can i modify this autogenerated code for ASP.NET pages/controls if i could somehow inject into process and do simple do string replace i could use double alliase and everything would work fine. For clarification i mean this kind files :

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f3552813\29b6906c\App_Web_XXXXX.aspx.65a2d1ee.p58-fzio.0.cs

Update 1. You guys didnt understand problem, standard system library System.Web has class System.Web.UI.Page, library that i am loading during runtime has the same type( namespace and class ). And now when ASP.net compiles pages - *.aspx, *.ascx files are compiled - it cant tell which library should it use and i get error :

CS0433: The type 'System.Web.UI.Page' exists in both dlls

svick
  • 236,525
  • 50
  • 385
  • 514
  • its better to avoid to even try to modify the auto-generated code ! – Aristos Jan 06 '13 at 13:07
  • quick googling found this trick: http://stackoverflow.com/questions/1757289/where-does-error-cs0433-type-x-already-exists-in-both-a-dll-and-b-dll-come does that help? – Nahum Jan 07 '13 at 05:54

1 Answers1

2

Using temporary files and directories is not a good pattern. Solution is to modify the code - please put as example.

siranen
  • 374
  • 1
  • 11