pedro.peixoto 0 Posted November 30, 2010 Report Share Posted November 30, 2010 Boa tarde a todos mais uma vez Se alguém me puder ajudar com este erro agradecia. Estou a programar em C# VisualStudio 2010 e estou a guardar a minha connectionString em app.config e ao atribuir a uma string o valor guardado na config: string StrCon = ConfigurationSettings.AppSettings["StrCon"]; estou a receber este warning: Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings' Alguém me sabe dizer como resolvo isto? Obg Link to post Share on other sites
Rechousa 70 Posted November 30, 2010 Report Share Posted November 30, 2010 Usa o ConfigurationManager em vez do ConfigurationSettings. http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.appsettings.aspx Pedro Martins Sharing is Knowledge! http://www.linkedin.com/in/rechousa Link to post Share on other sites
pedro.peixoto 0 Posted November 30, 2010 Author Report Share Posted November 30, 2010 Desculpa a pergunta ignorante mas E como é que eu faço isso? Estou a usar o system.configuration e não me aparece ConfigurationManager, apenas ConfigurationSettings. Link to post Share on other sites
Rechousa 70 Posted November 30, 2010 Report Share Posted November 30, 2010 Precisas de fazer duas coisas: - Adicionar a Assembly System.Configuration ao teu projecto (Em cima do projecto -> botão direito do rato -> Add Reference -> .Net -> System.Configuration) - usar a assembly: using System.Configuration; Pedro Martins Sharing is Knowledge! http://www.linkedin.com/in/rechousa Link to post Share on other sites
pedro.peixoto 0 Posted November 30, 2010 Author Report Share Posted November 30, 2010 Obrigado!! Faltava só adicionar a Assembly. Bastou isso para o warning desaparecer, mesmo estado com ConfigurationSettings, de qualquer forma já alterei para o ConfigurationManager. Obrigado Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now