Type or namespace name 'MySQL' could not be found VS2017





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







6















Currently trying to create a connection to a MySql Database. When I added




using MySql.Data;
using MySql.Data.MySqlClient;



to my class I recieved the typical "The type or namespace name ... could not be found". A little searching made me realize I was missing the MySql.Data.dll.



I used Packet Manager console to install MySql.Data:



PM> Install-Package MySql.Data



I verified that it was installed via Tools > NuGet Package Manager > Manage NuGet Packages for Solutions, but I was still getting the build error.



At this point I figured, since the PM downloaded the .dll I'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll.



Great!! The red squiggly went away on my using and intellisense started working for classes inside the MySql.Data namespace:



enter image description here



Fast forward 10 mins, I finish writing my test class and hit Build and error comes back:



enter image description here



So in summary, using PM to install MySql.Data got me no where. Manually adding the reference of MySql.Data.dll got my intellisense to recognize the namespace and classes, but when it comes to building I still get the error.



Pretty stumped. Anyone seen this?










share|improve this question


















  • 1





    Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

    – Amardev Joynauth
    Nov 8 '17 at 6:05











  • Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

    – Flippi
    Nov 8 '17 at 13:54




















6















Currently trying to create a connection to a MySql Database. When I added




using MySql.Data;
using MySql.Data.MySqlClient;



to my class I recieved the typical "The type or namespace name ... could not be found". A little searching made me realize I was missing the MySql.Data.dll.



I used Packet Manager console to install MySql.Data:



PM> Install-Package MySql.Data



I verified that it was installed via Tools > NuGet Package Manager > Manage NuGet Packages for Solutions, but I was still getting the build error.



At this point I figured, since the PM downloaded the .dll I'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll.



Great!! The red squiggly went away on my using and intellisense started working for classes inside the MySql.Data namespace:



enter image description here



Fast forward 10 mins, I finish writing my test class and hit Build and error comes back:



enter image description here



So in summary, using PM to install MySql.Data got me no where. Manually adding the reference of MySql.Data.dll got my intellisense to recognize the namespace and classes, but when it comes to building I still get the error.



Pretty stumped. Anyone seen this?










share|improve this question


















  • 1





    Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

    – Amardev Joynauth
    Nov 8 '17 at 6:05











  • Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

    – Flippi
    Nov 8 '17 at 13:54
















6












6








6








Currently trying to create a connection to a MySql Database. When I added




using MySql.Data;
using MySql.Data.MySqlClient;



to my class I recieved the typical "The type or namespace name ... could not be found". A little searching made me realize I was missing the MySql.Data.dll.



I used Packet Manager console to install MySql.Data:



PM> Install-Package MySql.Data



I verified that it was installed via Tools > NuGet Package Manager > Manage NuGet Packages for Solutions, but I was still getting the build error.



At this point I figured, since the PM downloaded the .dll I'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll.



Great!! The red squiggly went away on my using and intellisense started working for classes inside the MySql.Data namespace:



enter image description here



Fast forward 10 mins, I finish writing my test class and hit Build and error comes back:



enter image description here



So in summary, using PM to install MySql.Data got me no where. Manually adding the reference of MySql.Data.dll got my intellisense to recognize the namespace and classes, but when it comes to building I still get the error.



Pretty stumped. Anyone seen this?










share|improve this question














Currently trying to create a connection to a MySql Database. When I added




using MySql.Data;
using MySql.Data.MySqlClient;



to my class I recieved the typical "The type or namespace name ... could not be found". A little searching made me realize I was missing the MySql.Data.dll.



I used Packet Manager console to install MySql.Data:



PM> Install-Package MySql.Data



I verified that it was installed via Tools > NuGet Package Manager > Manage NuGet Packages for Solutions, but I was still getting the build error.



At this point I figured, since the PM downloaded the .dll I'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll.



Great!! The red squiggly went away on my using and intellisense started working for classes inside the MySql.Data namespace:



enter image description here



Fast forward 10 mins, I finish writing my test class and hit Build and error comes back:



enter image description here



So in summary, using PM to install MySql.Data got me no where. Manually adding the reference of MySql.Data.dll got my intellisense to recognize the namespace and classes, but when it comes to building I still get the error.



Pretty stumped. Anyone seen this?







c# mysql






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 '17 at 5:49









FlippiFlippi

165111




165111








  • 1





    Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

    – Amardev Joynauth
    Nov 8 '17 at 6:05











  • Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

    – Flippi
    Nov 8 '17 at 13:54
















  • 1





    Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

    – Amardev Joynauth
    Nov 8 '17 at 6:05











  • Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

    – Flippi
    Nov 8 '17 at 13:54










1




1





Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

– Amardev Joynauth
Nov 8 '17 at 6:05





Came across this post stackoverflow.com/questions/1102281/… Hope it helps solve your issue.

– Amardev Joynauth
Nov 8 '17 at 6:05













Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

– Flippi
Nov 8 '17 at 13:54







Thanks for the link, but I've already done the solutions provided there. Step 4. of the marked solution even works for me: "At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you." This is true, it does do this and you can see in my screenshot that IntelliSense is working, but at compile time I still get there error...

– Flippi
Nov 8 '17 at 13:54














2 Answers
2






active

oldest

votes


















10














Solved this issue! Turns out the newest MySql.Data.dll is built off of .Net Framework 4.5.2, while my project was using .Net Framework 3.5 Client Profile.



Changing my project's framework to 4.5.2 solved the issue. It's quite strange that VS doesn't give a better error message.



To change your project's framework right click on your project (not the solution), select Properties -> Application -> Target framework. The target framework is a dropdown on that page.



I came to this realization thanks to another stackoverflower question: Namespace not recognized (even though it is there)






share|improve this answer

































    0














    In this situation MySQL dll files very new. You can download older dll files and includ in your project. I prefer this version. It works for me MySql.Data.DLL



    Downloaded the .dll You'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll






    share|improve this answer


























    • Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

      – Jess STJ
      Apr 6 at 16:52












    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47172430%2ftype-or-namespace-name-mysql-could-not-be-found-vs2017%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    10














    Solved this issue! Turns out the newest MySql.Data.dll is built off of .Net Framework 4.5.2, while my project was using .Net Framework 3.5 Client Profile.



    Changing my project's framework to 4.5.2 solved the issue. It's quite strange that VS doesn't give a better error message.



    To change your project's framework right click on your project (not the solution), select Properties -> Application -> Target framework. The target framework is a dropdown on that page.



    I came to this realization thanks to another stackoverflower question: Namespace not recognized (even though it is there)






    share|improve this answer






























      10














      Solved this issue! Turns out the newest MySql.Data.dll is built off of .Net Framework 4.5.2, while my project was using .Net Framework 3.5 Client Profile.



      Changing my project's framework to 4.5.2 solved the issue. It's quite strange that VS doesn't give a better error message.



      To change your project's framework right click on your project (not the solution), select Properties -> Application -> Target framework. The target framework is a dropdown on that page.



      I came to this realization thanks to another stackoverflower question: Namespace not recognized (even though it is there)






      share|improve this answer




























        10












        10








        10







        Solved this issue! Turns out the newest MySql.Data.dll is built off of .Net Framework 4.5.2, while my project was using .Net Framework 3.5 Client Profile.



        Changing my project's framework to 4.5.2 solved the issue. It's quite strange that VS doesn't give a better error message.



        To change your project's framework right click on your project (not the solution), select Properties -> Application -> Target framework. The target framework is a dropdown on that page.



        I came to this realization thanks to another stackoverflower question: Namespace not recognized (even though it is there)






        share|improve this answer















        Solved this issue! Turns out the newest MySql.Data.dll is built off of .Net Framework 4.5.2, while my project was using .Net Framework 3.5 Client Profile.



        Changing my project's framework to 4.5.2 solved the issue. It's quite strange that VS doesn't give a better error message.



        To change your project's framework right click on your project (not the solution), select Properties -> Application -> Target framework. The target framework is a dropdown on that page.



        I came to this realization thanks to another stackoverflower question: Namespace not recognized (even though it is there)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 9 '17 at 16:42

























        answered Nov 9 '17 at 0:54









        FlippiFlippi

        165111




        165111

























            0














            In this situation MySQL dll files very new. You can download older dll files and includ in your project. I prefer this version. It works for me MySql.Data.DLL



            Downloaded the .dll You'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll






            share|improve this answer


























            • Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

              – Jess STJ
              Apr 6 at 16:52
















            0














            In this situation MySQL dll files very new. You can download older dll files and includ in your project. I prefer this version. It works for me MySql.Data.DLL



            Downloaded the .dll You'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll






            share|improve this answer


























            • Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

              – Jess STJ
              Apr 6 at 16:52














            0












            0








            0







            In this situation MySQL dll files very new. You can download older dll files and includ in your project. I prefer this version. It works for me MySql.Data.DLL



            Downloaded the .dll You'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll






            share|improve this answer















            In this situation MySQL dll files very new. You can download older dll files and includ in your project. I prefer this version. It works for me MySql.Data.DLL



            Downloaded the .dll You'll just manually reference it via References > Add Reference > Browse > Select MySql.Data.dll







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 17 '18 at 7:42









            Foo

            1




            1










            answered Nov 16 '18 at 21:32









            BahodirBahodir

            111




            111













            • Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

              – Jess STJ
              Apr 6 at 16:52



















            • Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

              – Jess STJ
              Apr 6 at 16:52

















            Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

            – Jess STJ
            Apr 6 at 16:52





            Why is this downvoted? This solved my problem (though I didn't have to go download a new dll... if you have MySQL installed on your computer the dll will be there somewhere).

            – Jess STJ
            Apr 6 at 16:52


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47172430%2ftype-or-namespace-name-mysql-could-not-be-found-vs2017%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly