SQL Server Developer Center > SQL Server Forums > SQL Server Compact > Everything was compiling fine - and now this assembly reference error!
Ask a questionAsk a question
 

AnswerEverything was compiling fine - and now this assembly reference error!

  • Wednesday, November 04, 2009 11:37 PMpedroponting Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    My Windows Forms app, which uses SQL CE, was all working fine, I'd fixed the last bug, and I was trying to publish it to the net. I was experiencing some problems, and I may have fiddled with something somewhere, though I've tried to get everything back exactly as it was. However suddenly the darn thing won't work any more. On one computer I get told that the SQL CE assembly can't be found, which is weird because the path is correct, and in fact an earlier incarnation of the program works fine with apparently the same reference. I tried removing the reference and recreating it, but that didn't help. On a different computer - at home - I get a different problem. I'm told that the SQL CE database is an earlier version and please upgrade it. However the message states '[Db version =3505053,Requested version = 3004180]', so clearly  the database is *not* an earlier version, it's a *later* version than what the program expects. But why?? The one thing I did change was in Application Files in the Publish tab of the app properties, I set SQL CE  from publish status "prerequisite" to "include". That was because I was having issues at install time with a message saying SQL CE was not installed. However, I set this back to "Prerequisite" and it has made no difference. Any ideas? It's two days now and I'm getting nowhere, and the program was ready to launch!
    class Religion { Explain (event) { try { ToExplain(event)} catch { throw("God moves in mysterious ways") } } }

Answers

  • Friday, November 06, 2009 1:57 AMpedroponting Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Well, thanks, but that's not it, because I have 3.5 installed on both machines, and like I say everything was working fine. I certainly did not change the version of SQL CE I was using. I have managed to fix this by the expedient of going back to a backup that still worked, and copying the newer classes over into that project. 
    class Religion { Explain (event) { try { ToExplain(event)} catch { throw("God moves in mysterious ways") } } }
    • Marked As Answer bypedroponting Friday, November 06, 2009 1:57 AM
    •  

All Replies

  • Thursday, November 05, 2009 1:59 AMErikEJMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The database is 3.5 format, and your are trying to access it with the 3.1 runtime. Check the System.Data.SqlServerCe reference in your project.
    http://erikej.blogspot.com Erik Ejlskov Jensen - Please mark as answer, if this was it.
  • Thursday, November 05, 2009 4:04 PMImran Siddique [MSFT] Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    My Windows Forms app, which uses SQL CE, was all working fine, I'd fixed the last bug, and I was trying to publish it to the net. I was experiencing some problems, and I may have fiddled with something somewhere, though I've tried to get everything back exactly as it was. However suddenly the darn thing won't work any more. On one computer I get told that the SQL CE assembly can't be found, which is weird because the path is correct, and in fact an earlier incarnation of the program works fine with apparently the same reference. I tried removing the reference and recreating it, but that didn't help.

    Hi, here this seems to be versioning issue; your app might be compiled against 3.1 but the machine has 3.5 and hence the SQL CE assembly not found exception.

    On a different computer - at home - I get a different problem. I'm told that the SQL CE database is an earlier version and please upgrade it. However the message states '[Db version =3505053,Requested version = 3004180]', so clearly  the database is *not* an earlier version, it's a *later* version than what the program expects. But why?? The one thing I did change was in Application Files in the Publish tab of the app properties, I set SQL CE  from publish status "prerequisite" to "include". That was because I was having issues at install time with a message saying SQL CE was not installed. However, I set this back to "Prerequisite" and it has made no difference. Any ideas? It's two days now and I'm getting nowhere, and the program was ready to launch!
    Like Eric said, SQL CE 3.1 does not understand the File Format of SQL CE 3.5 and throws the exception.

    “This posting is provided "AS IS" with no warranties, and confers no rights”.
  • Friday, November 06, 2009 1:57 AMpedroponting Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Well, thanks, but that's not it, because I have 3.5 installed on both machines, and like I say everything was working fine. I certainly did not change the version of SQL CE I was using. I have managed to fix this by the expedient of going back to a backup that still worked, and copying the newer classes over into that project. 
    class Religion { Explain (event) { try { ToExplain(event)} catch { throw("God moves in mysterious ways") } } }
    • Marked As Answer bypedroponting Friday, November 06, 2009 1:57 AM
    •