Telerik ORM 2010.1 gives error Cannot find resource NorthwindModel.rlinq embedded in assembly ConsoleApplication1

24 posts, 0 answers
  1. Andre
    Andre avatar
    2 posts
    Member since:
    Jul 2010

    Posted 09 Jul 2010 Link to this post

    Hi,

    I've just created my first project with the new Visual Entity Designer. I Followed the steps explained in Stephen Fortes Blog:
    http://www.stephenforte.net/PermaLink,guid,734374ef-65ac-442c-a8f1-571ca9084729.aspx

    When I now try to run the application, I get a TypeInitializer Exception on that line:

     

     

     

    NorthwindEntityDiagrams d = new NorthwindEntityDiagrams();

    The Inner Exception is an ArgumentException and says:
    Cannot find resource NorthwindModel.rlinq embedded in assembly ConsoleApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    The BuildAction of NorthwindModel.rlinq is OpenAccessDeploy.
    My solution has only one project: "ConsoleApplication1".

    I'm using VS 2008 and Telerik ORM 2010.1.623.5

    The 2010.1 Version had been installed over an existing 2009.1 Version.

    my full code looks like this:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
      
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                NorthwindEntityDiagrams d = new NorthwindEntityDiagrams();
      
                var result = from c in d.Customers where c.Country == "Germany" select c;
      
                foreach (var customer in result)
                {
                    Console.WriteLine(customer.CustomerID);
                }
                Console.ReadLine();
            }
        }
    }

    The App Config looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <connectionStrings>
        <add name="NorthwindEntityDiagrams" connectionString="data source=.\sqlexpress;initial catalog=Northwind;integrated security=True" providerName="System.Data.SqlClient" />
      </connectionStrings>
    </configuration>

    Attached are Screenshots of the Telerik Designer and the solution explorer showing the properties of the rlinq file

    Any help would be really appreaciated.

    Thanks in Advance

    Andre

     

     

  2. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 14 Jul 2010 Link to this post

    Hello Andre,

    We tested the problem against the following versions of the product:
    - Telerik OpenAccess ORM 2010.1.414.3;
    - Telerik OpenAccess ORM 2010.1.623.5;
    but  we were unable to reproduce the failing behavior with the settings provided from you. It seems the error is thrown only when the Build Action is set to None.
    I hope you will find the attached example useful.

    Regards,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Andre
    Andre avatar
    2 posts
    Member since:
    Jul 2010

    Posted 14 Jul 2010 Link to this post

    Hello Damyan,

    thank you very much for your answer. In addition to this forum post, I had opened a support request. An answer to this support request has solved my problem.

    The problem was caused by a wrong entry in the openaccess.targets msbuild file (which I didn't touch). In this file, there's variable "OpenAccessPath" defined. In my installation it ended with a backslash. Because of this, the enhancer never fired during my bulid process because the EnhancerPath in the Build file starts with a backslash, too. So the generated path looked like this:
    c:program files\telerik\open access\\sdk\enhancer.exe.

    When I removed the backslash at the end of the open access path variable, everything started to work. My guess is that this file hasn't been replaced during my upgrade installation from 2009.1 to 2010.1 .. but that's just a wild guess.
  5. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 15 Jul 2010 Link to this post

    Hello Andre,

    We are glad to see that you managed to cope with the problem. It seems the OpenAccess.targets file was not updated during the update of the product and the new enhancer cannot work correctly with this path.

    Sincerely yours,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Cristian Apavaloaiei
    Cristian Apavaloaiei avatar
    25 posts
    Member since:
    Aug 2008

    Posted 15 Oct 2010 Link to this post

    I'm having the same problem, i have a clean install of OpenAccess 2010.2... The weird thing is that it was working until this morning, and i have no idea what could have caused the custom tool not run anymore. I tried setting the build action to Embedded Resource, it embeds the resource in this case but i get other runtime errors (i'm guessing this is why i have to use OpenAccessDeploy).

    The only thing that i can think of that i modified since this morning was installing two visual studio fixes, this one and this one.

    I also checked the OpenAccess.targets file in C:\Program Files\Telerik\OpenAccess ORM\sdk and i had 
    <PropertyGroup>
        <UseOpenAccessTargets Condition="'$(UseOpenAccessTargets)'==''">true</UseOpenAccessTargets>
        <OpenAccessPath Condition="'$(OpenAccessPath)'==''">C:\Program Files\Telerik\OpenAccess ORM\</OpenAccessPath>
        <EnhancerAssembly>$(OpenAccessPath)\sdk\enhancer.exe</EnhancerAssembly>
    </PropertyGroup>
    I tried removing the last backslash from the openaccesspath and it still doesn't work.
  7. Cristian Apavaloaiei
    Cristian Apavaloaiei avatar
    25 posts
    Member since:
    Aug 2008

    Posted 18 Oct 2010 Link to this post

    I still haven't found a cause for this problem, but i recreated the project and everything works just fine now. I hope this problem doesn't appear again, the custom build action used to work in the old project too until a couple of days ago.
  8. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 19 Oct 2010 Link to this post

    Hi Cristian Apavaloaiei,

    I am glad to see that you managed to handle this problem. One possible cause for the error behavior is damaged project file in some way after installing these features. Could you verify that the project file is not modified after the install?

    Best wishes,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Cristian Apavaloaiei
    Cristian Apavaloaiei avatar
    25 posts
    Member since:
    Aug 2008

    Posted 20 Oct 2010 Link to this post

    I'm sorry but i deleted that project file when removing the old project, if this problem appears again i will analyze the project file in more depth.
  10. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 22 Oct 2010 Link to this post

    Hello Cristian Apavaloaiei,

    If the error persists please let us know. It would be helpful if you can provide us with the project file or a sample application in order to investigate this behavior on our side.

    Greetings,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Bill
    Bill avatar
    2 posts
    Member since:
    Oct 2010

    Posted 02 Nov 2010 Link to this post

    I am using version 2010.2.714.1 and just created a new WinForms application in VS2010.

    I created my model off of an existing database, it generated the rlinq file and the associated CS file. (I told it to put everything in a single file).

    When I run the app and call :  MyDBContext db = new MyDBContext():

    I get the same error message that started this thread.  The inner message is telling me that it can't find the rlinq file in the assembly and if I trace into it, it's this call that's blowing up:

    private static MetadataSource metadataSource = XmlMetadataSource.FromAssemblyResource("MyDBRQ.rlinq");

    That is the proper name of my RLINQ file, so not sure why it's having trouble.

    I haven't had any issues with MVC apps using OA, just my WinForms app now.

    On a side note, are the samples and such that are included with OpenAccess going to be updated?  I tried to build the WinForms sample (using VS2008) and couldn't get it to build.

    Also - all of your tutorials are out of date (which you probably already know <G>) - many of the examples, including your PDF that gives a "STEP BY STEP tutorial" which has a date of March 2010 in it seems to be out of date (http://www.telerik.com/support/documentation-and-tutorials/step-by-step-tutorial-for-openaccess.aspx) - the screen shots don't match what I see when I use the product.
  12. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 08 Nov 2010 Link to this post

    Hello Bill,

    1. I was unable to reproduce the false behavior on my side. I tested the scenario against the following version of the product: 2010.1.714. I have to ask you for a sample application which demonstrates the error in order to investigate the issue further.
    2. Yes, the tutorial uses previous version of the product. You could use our online help documentation which is up-to-date.

    Kind regards,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Herr
    Herr avatar
    23 posts
    Member since:
    Feb 2009

    Posted 09 Nov 2010 Link to this post

    Hi Bill,

    maybe you need to use AttributesMetadataSource instead...?
  14. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 11 Nov 2010 Link to this post

    Hello Michael,

    Yes, we tested the scenario using AttributesMetadataSource as well. Could you please verify that Build Action for the rlinq file is set to OpenAccessDeploy?
    1. Select the rlinq file from the Solution Explorer;
    2. Press F4 and find the 'Build Action' setting under the Properties Window grid;
    We are looking forward to your reply.

    All the best,
    Damyan Bogoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Feb 2011 Link to this post

    Hi Guys,

    I'm new to Open Access and I'm having the same issue. I have followed the documentation that was installed with OA to the letter 3 times. the only difference being I am running this as a WinForms app.

    I am trying to re-create the Model First demo with Students and Region. All teh tables are created correctly, though the documenation is slightly out in that it doesn't inform you that you need to set the precision on the column, and also the entities that it creates all have the column types set to Object rather than the correct value type.

    I have verified that the Build Action of the rlinq file is set to OpenAccessDeploy.

    For information, I am running the latest version of both the WinForms controls and Open Access and am running SQL Server Express 2008 with Windows Authentication, .NET 4, Windows 7 64 bit.

    The error is:  Message=Cannot find resource MyDatabase.rlinq embedded in assembly Telerik.OpenAccessTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
           Source=Telerik.OpenAccess

    Any advice would be appreciated.
    Thanks
    Richard
  16. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Feb 2011 Link to this post

    Hello,

    Small update on this. If I open the Model Settings and change over the Mapping type from XML to Attributes, then I now get the following error on the Regions
    "No metadata has been registered for class"

    It also seems that none of the classes have been marked as persistant.
    Thanks in advance
    Richard
  17. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 07 Feb 2011 Link to this post

    Hi Richard Slade,

     It seems that the enhancer has not run, and your classes are not enhanced. Could you verify if the following line of XML is part of you project file (Open your .csproj or .vbproj file with an XML editor). 

    <Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')" Project="$(MSBuildExtensionsPath)\OpenAccess.targets" />

    Greetings,
    Zoran
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  18. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 07 Feb 2011 Link to this post

    Thanks for the reply. This line did not appeat in my vb.proj file. I added it but it has currnetly made no difference.
    thanks
    Richard
  19. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 10 Feb 2011 Link to this post

    Hello Richard Slade,

     This means that the OpenAccess.targets file is not placed in your MSBuild directory. That file should be  installed together with the OpenAccess product in your MSBuild directory: C:\Program Files (x86)\MSBuild or C:\Program Files\MSBuild. Could you check if you have this file available in one of those directories? The fact that it could not be there indicates that OpenAccess might not be correctly installed or maybe not installed at all on the machine that you are using at the moment.

    Greetings,
    Zoran
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  20. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 10 Feb 2011 Link to this post

    Hi Zoran,

    I'm very pleased to say that a re-install of Open Access has solved the issue.
    I may be mistaken, but I seemed to notice though that after the upgrade the first time I tried it, it still didn't work. The reason for it not running this time seemed to be that when I started a new project (VS 2010), the project is created in the appdata directory, as it should be until I decide to save the solution to the usual MyProjects directory. Open Access seemed to be unable to decorate the vbproj file with the ImportCondition until I had saved the solution to it's permenant save path. The second time I tried it, I saved the solution first to the MyProjects directory and the project file was amended and re-loaded as it should be. Is this normal?

    Anyway, I'm very pleased it's working now. Thanks for your guidance.
    Regards,
    Richard
  21. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 11 Feb 2011 Link to this post

    Hi Richard Slade,

     Firstly, I am very glad that this issue is finally resolved on your side and you are able to continue your development with OpenAccess. I can not confirm that what you mentioned is the reason for the bad  experience as we have not observed such behavior yet. It is not normal that the project editing by our designer is dependent on the location where the customers solution is saved.

    Anyway, good that it is finally solved. Maybe you could try with a new project which is not previously saved to your projects folder, but in the temporary one instead. Than you can observe if those errors re-appear. That way we could be sure if this was the actual cause or not and if it is we will schedule it for further investigation and fixing.  

    Best wishes,
    Zoran
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  22. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 11 Feb 2011 Link to this post

    Hi Zoran,

    Yes, all working fine now and I love using Open Access. I have tried again with a new project and I can consistantly replicate the issue though.
    1. Start a new VS2010 Winforms project (vb.net in this case)
    2. Add an empty domain model, giving db connection details. Leave other defaults as per the demo
    3. I am then prompted that it needs to be enhanced. I click OK
    4. I am prompted to save the solution to it's permanant location. I save
    5. I add a couple of tables and map to persistant type

    The first clue that something is wrong is that the created entities do not have the correct types. I specified Id(int) Name(varchar) for exmaple for region, and they are both specified in the entity as Object. See screenshot.

    I'm happy to open a support ticket and help out in any way that is required, so please just let me know.
    regards,
    Richard

  23. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 16 Feb 2011 Link to this post

    Hi Richard Slade,

     We verified the issue and yes you are right, it is better when you have your solution saved to you 'real' directory. Also regarding the wrong mapping, it is a bug on our side with a very easy workaround again and that is closing and re-opening the .rlinq file. We internally handle the TypeResolver when the diagram is being opened, but as you have observed there can be problems on the very first load of the designer when it is not yet saved.

    Thanks a lot for the feedback, we appreciate it very much and we will do our best to improve this user experience for our next release. Your Telerik points have been updated.

    Regards,
    Zoran
    the Telerik team
  24. Dewey
    Dewey avatar
    1 posts
    Member since:
    Jul 2011

    Posted 12 Oct 2011 Link to this post

    I have been having this same issue with 2011.2.908.1. I checked my .proj and the correct entry is there. My build action is set to OpenAccessDeploy. I checked my OpenAccess.targets file and it had the extra \ in there so I removed it. The issue still occurs when it hits this line in my EntityDiagrams1.cs file.
    private static MetadataSource metadataSource = XmlMetadataSource.FromAssemblyResource("EntityDiagrams.rlinq");

    I also have an issue where the generated .cs is EntityDiagrams1. Originally it was EntityDiagrams and then it created a second file. I've deleted all of the generated files, cleaned the solution and when I rebuild it still creates EntityDiagrams1.cs... kind of annoying.
  25. Serge
    Admin
    Serge avatar
    375 posts

    Posted 17 Oct 2011 Link to this post

    Hi Dewey,

     If you get a problem in this line, this means that the rlinq file has not been embedded in the assembly (it is usually embedded by the OpenAccessDeploy task). Please locate the import statement in the project file and remove its condition attribute, this way when you try to reload the project you will see whether the file is correctly located. 

    It would be best if you could send us the project you are experiencing this error with, so that we can more easily locate the culprit. (You will have to open a support ticket in order to be able to attach the project though)

    As to the problem with the name of the generated file, this is a Visual Studio bug that you can easily work around. Just (again) open the project file definition and locate the LastGenOutput tag, of the rlinq file and edit its name to the one you want.

    I hope this is helpful.

    Best wishes,
    Serge
    the Telerik team

    Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

Back to Top
DevCraft banner