I'm trying to use Log4net for my c# application. But when my application runs it generates log4net.xml file. As I read , It includes some information related to use in .NET documentation . But I no need this file or documentation.
How to disable log4net.xml file generation.
Your application is NOT generating this file. This file is part of the Log4Net project alongside with the assembly (log4net.dll) and the public debugging symbols (log4net.pdb). Those file are simply copied to your application's output directory. If you don't want to have them (even though it is strongly recommended to keep them), you could remove them from the source.
If on the other hand you downloaded the source code of Log4Net and compiled it yourself, then you could disable XML documentation generation in the properties of the project. In this case no log4net.xml file will be emitted.
If you are using log4net project from NuGet, remove log4net.xml file from the packages folder that was created by the NuGet(that file is under the /lib/<.net framework version>) and it will not get copied to your output.
Open command prompt as administrator
cd C:\WINDOWS\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304
Rename log4net.dll 64bit to log4net64.dll
Copy log4net.dll 32bit to folder
C:\WINDOWS\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304
Related
Issue:
Applies to: .Net core 3.1 WPF Gui application
in a .net core application, I cannot find the configuration file.
It must have been created somewhere since the application can load and store settings correctly.
Anyone an idea where the file might have been saved?
Steps to reproduce
Create .net core wpf gui app
Create a Settings File:
Write stuff to configuration:
config.Default.LastUpdate = DateTime.Now;
config.Default.Save();
config.Default.Reload();
Relaunch the application and make sure that stuff is loaded correctly from the configuration:
According to the Microsoft Documentation and to Experience from previous .Net 4.5 Apps, a config.xml file should be created in the application's directory. But there is nothing to be found:
Also a Search in the whole project directory yields no result:
The settings files are now saved under the following path:
C:\Users\[username]\AppData\Local\[Your_App_Name]\[Your_App_Name]_Url_yhk4xacfqpnpuvqwry4zvrqsrky5rxpk\[Version]
I guess you are looking for a file in a wrong directory. I've followed steps and created *.settings file. It's located in same folder along with *.csproj file.
You've mentioned config.xml file. Guess, now it's a part of a *.settings file. Try to open a *.settings file with some code editor like VS Code and you will see an xml inside of it. I guess that's what you're looking for.
I use xsltc.exe in developer console (ms visual studio). I try to generate a DLL that could be used in a .NET project.
xsltc /settings:dtd /settings:document /settings:script /c:Bk24.Specs specs.xsl /out:Bk24Specs.dll
I have successfully generated many of such DLLs before, but now I have a big problem. The current XSL contains a reference to an XML
<xsl:variable name="spcodes" select="document('specialCodes.xml')/list/data" />
I successfully generated the DLL for this template. I added a reference to this DLL in the .NET project. But then, the application throws an exception
File not found (c:\projects\bk24\specialCodes.xml)
in the real production environment. Of course, on the client's workstation there is no such directory C:\projects\bk24\. It's my directory on my dev machine, but when I ran xsltc.exe, I put specialCodes.xml into the same directory where the XSL is placed. I hoped that xsltc.exe would look at the directory, found that XSLs and XMLs are in the same directory, so, the generator will embed the XMLs into this DLL, but, it seems, it's not...
How can I resolve this issue?
If it is only a read only file, then open the file in a text editor and copy it. Then embed it as a string in any cs class and read with XElement.Parse(that_string)
I have created an application in which every installation is differed by the configuration file.
Currently the configuration file (settings.setting) is part of the installer itself.
Is there a way to create an installer without the settings.setting embedded inside it, so will have the setup.exe and a separate settings.setting file?
(So will have 1 installation build, and the installation will copy the setting file to the relevant location as done if it is part of the installation build)
Thanks,
Yoav
Maybe you should try to extract the config file to another file and link it from default config file.
MyApp.exe.config would containt a line like this:
<appSettings configSource="pathtoconfig\MyExternalAppSettings.config" />
Here's a good blog post on this subject.
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).
I need to generate a list of all the files which are enough to run my application on any machine. I need this for a setup program. When i go to bin/release folder i'm able to see some pdb files and some configuration files, which i think will not be needed. I tried to disable generation of pdb files too but it still generates pdb for the other projects present in the solution.
So i need a way in visual studio 2008, which can get me all the files (the .exe and .dll and other files) required by my application to run.
Thanks.
Have you tried publishing the application (Build > Publish [app])?
This should just copy all the essential files to the specified folder.
The pdb files are used for debugging. Building in "Release" mode should exclude these files.
You can also create a setup project within the solution. Using that project it is possible to see a list of included files.
If you make a release build or publish the application then you should have a complete set of assemblies your application needs.
However, it can still rely on assemblies which reside in the GAC (Global Assembly Cache) of your machine. Check the references of your project if you think there are assemblies missing in the bin folder.
To solve this exact problem with our software, we wrote a simple console app that finds all the .vbproj & .csproj files in our projects directory, then changes all of the to Release mode (which does not create pdb files, documentation files etc).
This is then run by the build machine (CruiseControl.Net) before it starts compiling the projects.