I am just learning about app.config in respect of creating custom sections. I have that part working, it compiles and gets the information out as required but I get warnings about it could not find the schema information.
I have done a bit of googling and could not find a simple explanation of this situation.
The approach (that seems to make sense to me at the moment) would be to have a schema file for each section within that project. I understand how to create a schema file, but do not know how I would like this into the project.
Also when it is compiled and deployed to another machine I presume that schema file would need to be copied across as well.
Thanks for any and all help
Jon
Try linking the app.config file to the corresponding schema (ussually you can find it on C:\Program Files\Microsoft Visual Studio 8\xml\Schemas\DotNetConfig.xsd) ,to do so just open the app.config file in visual studio, open the properties window (F4) and put the path above to schemas.
Pablo.
Related
In my application i have a bunch of string definitions.
I have put them as within the resources of visual studio with the idea so that it would save as an xml .resx file. The reason for this, is that after deployment i would be able to change some string definitions when i need to for some reason.
So, i have set the resources properties build action to be "XamlAppDef" and the Custom tool is automatically set to "PublicResXFileCodeGenerator" by visual studio.
Furthermore i linked system.xaml in my project references.
Although the .resx file is automatically generated, i now get an error during compile:
The XAML MSBuild task only processes files that contain an '{http://schemas.microsoft.com/winfx/2006/xaml}Class' directive. Please refer to documentation for usage of ‘{http://schemas.microsoft.com/winfx/2006/xaml}Class’
i tried figuring out how to fix this, but i cant really seem to figure it out. Any thoughts ?
The XamlAppDef is exactly only for XAML, not RESX resources. Use the Content build action instead.
My interest is in the first place regarding solution files containing C# projects.
Is there anything, like the exact .NET framework version, user names and passwords, any other information that can identify the machine the solution file was created on?
No. Take a look at the file. It just enumerates all projects in your solution and their build configuration.
Places where you can find computer-specific stuff might be the project files and the .suo file (which you usually don't send to version control) and the PDBs of the compiled assemblies (they contain file paths, etc.).
No, as Patrick Hofman has already answered, .sln file just contains a list of .csproj project files.
However,
Exact target .NET Framework version is stored in .csproj files.
Username isn't stored anywhere if you do not specify it yourself, except for different places like assembly references, PDB files, different configuration files, if you use user-specific pathes like C:\Users\yourusername\My Documents\Visual Studio Projects\ConsoleApplication1 etc.
Also, note that there is a thing like file metadata. It is not related to Visual Studio at all, but it can store information about file creator. As for me, I see my computer name and domain username in Details tab of file properties.
Connection strings are stored in .config (App.config, Web.config etc) files. You definitely wouldn't want to commit your login and password to a public database.
I've installed Stylecop via NuGet. I wish to disable some rules, and I know this can be done via a configuration file from what I've read. However, I can't find the file anywhere, and there seems to be little documentation describing where to create the file.
How do I go about making the file?
Edit: As this question still seems to be getting attention a couple of years later, I recommend using Roslyn Analyzer based StyleCop now.
This has a few advantages:
It's actually maintained and active.
Takes advantage of Roslyn, and can perform some changes for you.
It's a NuGet package so is installed as part of your projects, meaning you no longer need to install the seemingly unmaintained StyleCop Visual Studio extension (that's if you can even find the right place to download it from in the first place!). This way you can enforce code style/conventions much easier in for example OSS.
Automatically creates the .ruleset file for you, and as a result of using Roslyn Analyzers you get IDE support for enabling/disabling rules.
If you installed Stylecop via NuGet (the StyleCop.MSBuild package), then you will not have the folder detailed in the other answers.
You will find the file in your project folder here:
packages\StyleCop.MSBuild.{version}\tools\Settings.StyleCop
You should copy this file to the root of your project.
If you would rather not manually edit the file, there is also a nice gui tool called StyleCopSettingsEditor in the tools folder, which you can just drag your settings file onto.
If you copy the Settings.StyleCop file to the root of the solution, then it will be inherited by all projects. This means it can be kept in Source Control and accessed by any Continuous Integration server you are using.
If you reference and alter the file in C:\Program Files (x86)\StyleCop {{version}}\Settings.StyleCop this needs to be kept inline on each developer's PC. where as copying it to the root of the solution
The file Settings.StyleCop should be located in your install directory, on my machine it's here:
C:\Program Files (x86)\StyleCop 4.7\Settings.StyleCop
You can edit the rule settings by opening this file with StyleCopSettingsEditor.exe, located in the same directory (double-clicking the settings file will do the trick).
I had a Properties file called RecentFileList within my Visual Studio 2012 project and I removed it. I believe it was a .settings file. Now when I run my setup project, it is trying to copy files that it shouldn't care about and it's bombing out as a result. I get 3 errors (-1007 -6271 and -6103), all related to the same missing file.
-6103: Could not find file "C:\Users\Charles\Documents\Visual Studio 2012\Projects\RallyCourses\RallyCourseDesigner\bin\Debug\Properties\RecentFileList.Designer.cs
What file do I need to edit to get rid of the reference to this file? I tried searching for RecentFileList.Designer.cs, but can't find it.
The offending files in my situation were trying to be installed by the installer, but I had removed them from the main project. Within the SetUp project, there is a section Specify Application Data -> Files. I found the files in the Properties section there, removed them, and things are working now...
I am building a C# application. it has some parameters saved of a file named "settings.ini" .
Of course, I managed my application to read settings ,offer an interface for editing them and finally save them back to the ini file.
Would you please tell me how to include this setting file to the installation package (VS2008)
Thanks.
Instead of using an ini file, you should be using a .config file - that's the normal configuration option for .NET application with quite a lot of built in support.
You should be able to add an app.config file to your project from the new item screen in Visual Studio.
Take a look at Configuration Files on MSDN for more detail and the AppSettings class (this page includes some examples).