VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

Last post 08-21-2006 1:38 AM by jhol3990. 14 replies.

Sort Posts:

  • VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    05-03-2006, 10:45 PM

    Got an issue with an upgraded project from VS.NET 2003.  As it is migrated from an old project, it uses the old DataAdapter / SqlCommand / DataGrid way of doing things.  It works fine in 2005, but on some pages, when you edit an SqlCommand for example, all the SQL strings are moved from the codebehind to a resx file automatically by VS.NET 2005. It's not practical to rewrite all the old code, but it occasionally needs fixes, and it's no fun going through all the time and manually copying all the strings in the resx files back to the code behind every time. I would go so far as to claim this is a bug in VS.NET 2005.  Anybody seen this or know how to fix it?  Details below.

    In the code behind, Instead of
    this.sqlSelectCommand5.CommandText = "SELECT * FROM whatever";

    VS.NET 2005 changes it to
    this.sqlSelectCommand5.CommandText = resources.GetString("sqlSelectCommand5.CommandText");

    And when you run the page you get
    "Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "SDTR.reconcile_month.resources" was correctly embedded or linked into assembly "App_Web_gjoeff4z" at compile time, or that all the satellite assemblies required are loadable and fully signed."

    With the stack trace
    "[MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "SDTR.reconcile_month.resources" was correctly embedded or linked into assembly "App_Web_gjoeff4z" at compile time, or that all the satellite assemblies required are loadable and fully signed.]
       System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +655
       System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
       System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
       System.Resources.ResourceManager.GetString(String name, CultureInfo culture) +77
       System.Resources.ResourceManager.GetString(String name) +6
       SDTR.reconcile_month.InitializeComponent() in c:\dev\SDTR2005\SDTR2005Web\reconcile_month.aspx.cs:320
       SDTR.reconcile_month.OnInit(EventArgs e) in c:\dev\SDTR2005\SDTR2005Web\reconcile_month.aspx.cs:178
       System.Web.UI.Control.InitRecursive(Control namingContainer) +321
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692"

    "Llamas are cool"
  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    05-04-2006, 8:06 PM
    • Member
      168 point Member
    • wendyyanwei
    • Member since 07-01-2003, 3:44 PM
    • Posts 36
    • AspNetTeam
    This is by design in VS 2005 due to serialization consideration. The workaround for this is to change GetString to GetLocalResource
  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    05-23-2006, 12:34 AM

    Thanks Wendy.  Still no luck though.  There does not seem to be method called "GetLocalResource" in the System.ComponentModel.ComponentResourceManager object. Couldn't find that method anywhere in the framework on a quick search of the help. 

    Would be interested to know why serialisation is a consideration for an embedded SQL string.  Not that I doubt you Smile [:)].

     

    "Llamas are cool"
  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 10:26 AM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    Any resolution on this? This issue has us dead in the water...Crying

    Also - why would this be 'by design'. Why would you design an IDE - straight out of the box that generates code that renders the webservice project completely broken. And in addition - generates an error that is so cryptic that it takes a week just to figure out what is going on?

    If it is 'by design' then why doesn't the IDE generate the correct code to have the project work?

    I've never experience this type of behavior in VS2003 - so I am disturbed by this. It also has my .NET shop in a quandry because we haven't found an acceptable work-around yet.

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 10:44 AM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    There is no GetLocalResource method found on the ComponentResourceManager object.  Also - I can't find GetLocalResource anywhere in the VS 2005 documentation. Does someone know of a workaround or a fix for this?

    Right now - everytime we use the IDE wizard to create a dataadapter - we have to go in and rip out the strings created in the .RESX file and put them in the actual webservice code. This has brought us to our knees in terms of productivity - as we do tons of webservices with dataadapters - and this is truly a step backwards.

    Why doesn't the IDE produce code that works in this scenario?

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 12:05 PM
    • Member
      168 point Member
    • wendyyanwei
    • Member since 07-01-2003, 3:44 PM
    • Posts 36
    • AspNetTeam

    I am sorry this has cause you a lot of trouble and we did not provide you with a successful solution yet. Now there are two possible workarounds for you:

    1. Continue to migrate your VS2003 to VS2005 Website project and you will encounter this issue. To overcome this issue, you need to do as follows because .resx files are not handled the same way for ASP.Net 2.0 website projects as they are for client win form projects unfortunately.  The technique you’re using with GetString will not work for websites. 

    If these are intended to be page specific resources then the .resx file will need to be added to a special folder called App_LocalResources.  This folder is dynamically compiled by ASP.Net 2.0.  This special folder should be added to the same folder containing the page.

     To access the resources you’ll need to generate code like this:

    GetLocalResourceObject("sqlCommand1.Commandtext").ToString()

    For more information http://msdn2.microsoft.com/en-us/library/ms228093.aspx 

    The “Generate Local Resources” command in VS will do this automatically change its behavior for websites when the .aspx file is opened in design mode.

    2. migrate your VS2003 project to VS2005 Web Application Project. You can find the download site from http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx. Since WAP is like a client project, this will not be an issue for you.

    Let me know if these workaround does not help and I will work with you to find a solution. You can send me email directly.

    Wendy

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 12:32 PM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    Wendy - thank you for your very responsive post. I REALLY APPRECIATE IT!! (i.e. can you tell I'm freaking out?!?!?!).

    I will try this workaround tonight. Previously I had tried moving it into the APP_GLOBALRESOURCES folder - but I was experiencing the same behavior. I will let you know how it goes and work with you. I have a lot of people interested in this resolution.

    Thanks again!

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 2:19 PM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    Wendy - the workaround provided does not work. I move the .resx file to the appropriate folder (i.e. the local resources folder) and I still get the same errors. Also - I still do not have a GetLocalResourceObject method available. This method is available in HTTPCONTEXT and TEMPLATECONTEXT - but I am working with a WEBSERVICE and none of the documentation provides me with an overloaded method that just takes one parameter.

    The HTTPCONTEXT method takes two parameters. I tried to use it but it asks for a virtual directory. I tried putting several values in here and nothing seemed to work.

    Here is the code in my WebService. If you will note the TWO RED LINES are the culprits. I think it is the first line that actually fails because it can't find the .resx file. Moving it the APP_LocalResources folder does not fix the problem.

    Commenting out the line and using GetLocalResourceObject also does not work. All of the documented examples of GetLocalResourceObject only take one parameter - however in the code it is asking for TWO PARAMETERS and I don't know what to feed it.

    Once again this code is 100% generated by the IDE. The IDE needs to be my friend and generate code that works - so I can get on with the business of serving my customers. I'm not trying to be difficult - and I apologize if I come off this way. I need the IDE to generate these statements and have them work! - Thank you for your help.

    Private Sub InitializeComponent()

    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Service))

    Me.sqlSelectCommand1 = New System.Data.SqlClient.SqlCommand

    Me.sqlInsertCommand1 = New System.Data.SqlClient.SqlCommand

    Me.sqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand

    Me.sqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand

    Me.sqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter

    Me.sqlConnection1 = New System.Data.SqlClient.SqlConnection

    '

    'sqlSelectCommand1

    '

    Me.sqlSelectCommand1.CommandText = "SELECT SCommLog.*" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FROM SCommLog"

    Me.sqlSelectCommand1.Connection = Me.sqlConnection1

    '

    'sqlInsertCommand1

    '

    Me.sqlInsertCommand1.CommandText = Resources.GetString("sqlInsertCommand1.CommandText")

    Me.sqlInsertCommand1.Connection = Me.sqlConnection1

    Me.sqlInsertCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@PlantCode", System.Data.SqlDbType.VarChar, 0, "PlantCode"), New System.Data.SqlClient.SqlParameter("@StationCode", System.Data.SqlDbType.VarChar, 0, "StationCode"), New System.Data.SqlClient.SqlParameter("@BinCode", System.Data.SqlDbType.VarChar, 0, "BinCode"), New System.Data.SqlClient.SqlParameter("@ActionCode", System.Data.SqlDbType.VarChar, 0, "ActionCode"), New System.Data.SqlClient.SqlParameter("@RequestDate", System.Data.SqlDbType.DateTime, 0, "RequestDate"), New System.Data.SqlClient.SqlParameter("@ProcessedDate", System.Data.SqlDbType.DateTime, 0, "ProcessedDate"), New System.Data.SqlClient.SqlParameter("@ProcessedFlag", System.Data.SqlDbType.VarChar, 0, "ProcessedFlag")})

    '
  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 2:25 PM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    Also - to duplicate this behavior - it is pretty easy. Just do this:

    1) Create a ASP.NET WebServices project

    2) Drag a SQLDataAdapter from the toolbox onto the Service.vb form in design mode

    3) Use the wizard (which will pop up when you drag the SQLDataAdapter to the form) to create the SELECT, UPDATE, INSERT & DELETE statements for any table you may have. (i.e. make sure you have some kind of database in server explorer - choose the connection and create the DataAdapter for any table you have)

    4) Run/test your project now - it will not work. It puts the SQLStatements in the .resx file now and your project is rendered useless now because it can't work with the .resx file.

    Please help! Thanks!

     

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 2:37 PM
    • Member
      30 point Member
    • fgauer
    • Member since 06-05-2006, 2:21 PM
    • Posts 6

    Also too - i may just get some programmers to roll through the code and use the sqlcommandbuilder to generate the UPDATE and INSERT statements and bypass this path altogether...

    ...this is most likely the intention by the MS ASP.NET teamp developers. It's just that I have so much code to go through (i.e. VS 2003 code) that it's going to be daunting.

    I do however like the sqlcommandbuilder concept as it saves us in the long run by dynamically reconstructing these SQL Commands when the schema changes.

    Thanks for your help - I'm just freaking out and trying to get a good 'go forward' strategy! You have been very kind and responsive.

     

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-05-2006, 3:09 PM
    • Member
      168 point Member
    • wendyyanwei
    • Member since 07-01-2003, 3:44 PM
    • Posts 36
    • AspNetTeam

    Will you be willing to try out the second option that I provided?

    In the meantime, we can work on a solution for your migration to Website scenario.

    Wendy

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-08-2006, 1:57 PM
    • Member
      12 point Member
    • mattfriends
    • Member since 11-24-2004, 9:45 AM
    • Posts 3
    any further news on this? i'm also stymied by the same problem, it's shut me down for literally days.

    matt
  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    06-08-2006, 8:39 PM
    • Member
      168 point Member
    • wendyyanwei
    • Member since 07-01-2003, 3:44 PM
    • Posts 36
    • AspNetTeam

    Hi Matt,

    Here is a forums post about the same issue as you experienced: http://www.eggheadcafe.com/forums/forumsearchbranch.asp?THREADID=48134&INTID=7

    There are a couple workaround in it. Give it a try and see if any works for you.

    If these don't work for you, please let me know.

    Wendy

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    08-18-2006, 8:29 AM
    • Member
      20 point Member
    • karurbalu
    • Member since 03-02-2006, 12:59 PM
    • Posts 4

    Any updates on this issue?  its really bugging me to the core.

    suggested workaround is, go for web app projects rather than web site projects..  any other workaround/fix..

    regards

    Balu

  • Re: VS.NET 2005 Auto creates resx files, and then the page will not run (MissingManifestResourceException)

    08-21-2006, 1:38 AM
    • Member
      5 point Member
    • jhol3990
    • Member since 05-23-2006, 12:47 AM
    • Posts 1

    There are a number of work arounds on the egghead cafe post mentioned above.

    I went for the using table adapters solution. This has  cleared the problem up for me.

    It appears there is no actual fix ... just changes/workarounds that require a bit of time and effort.

    regards

    Jeremy

Page 1 of 1 (15 items)