简体   繁体   English

如何防止 output 目录中的 app.exe.config 文件?

[英]How to prevent app.exe.config file in output directory?

I'm using VS2019, My project is a .net framework 4.8 c# winform, no app.config file in project, wrote <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> in .csproj/Project/PropertyGroup .我正在使用VS2019,我的项目是.net框架4.8 c# winform,项目中没有app.config文件,在.csproj/Project/PropertyGroup中写了<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> when build finished, the xxx.exe.config file generated in bin folder, I hate it, how to let it go?构建完成后, bin文件夹中生成的xxx.exe.config文件,我讨厌它,如何让它go?

file content:文件内容:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
  </startup>
</configuration>

Right-click on your Project Properties --> Build Events --> type these under Post-Build Event command line :右键单击您的项目属性->构建事件->在构建后事件命令行下键入这些:

del $(TargetDir)$(AssemblyName).exe.config

Update更新

change the Build Action of the app.config file to Resource .app.config文件的Build Action更改为Resource

The customer just deletes the app.config file.客户只需删除app.config文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM