2
I am developing an application in C#
and during development I came across the following mistake:
In the archive: Settings.settings
there’s a string
which stores the user name. Apparently this may be the problem, but I need this string
. What is the solution?
Code:
namespace MarcaBus.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Usuario {
get {
return ((string)(this["Usuario"]));
}
set {
this["Usuario"] = value;
}
}
}
}
In the archive app.config
i added a line to force execution with Administrator level:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MarcaBus.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<MarcaBus.Properties.Settings>
<setting name="Usuario" serializeAs="String">
<value />
</setting>
</MarcaBus.Properties.Settings>
</userSettings>
</configuration>
Hey, Marlon, what’s up? Prefer to post your code instead of posting images, usually when the question has only images it is closed. Hug!
– Pedro Paulo
Updated friend!
– Marlon Pereira