大话水浒现在怎么修改pacote de configg.pa...

I have a dll-type project that contains MSTest integration tests. On my machine the tests pass, and I want the same to happen on a CI server (I use TeamCity). But the tests fail, because I need to tweak some settings in app.config. This is why I was thinking to have a separate second app.config file that will hold the settings for CI server.
So I would like to have
app.config (I think this is required by VS)
app.Release.config (This is a standalone independent config file)
Thus if I select Release configuration in build config on CI, I would like to use app.Release.config file instead of app.config
This doesn't seem to be straightforward for simple .dll type projects. For web projects, I can do web config transformations. I found a hack how to do these transformations for a dll type project, but I am not a big fan of hacks.
What is a standard approach to tweak app.config files depending on build config for .NET projects (such as Debug, Release, ...)?
解决方案 Use
plugin. For more options and details of how to use SlowCheetah keep reading.
As you have already noticed, there is no default and easy way to use different config files for a Library type (.dll) project. The reason is that the current thinking is: "You don't need to"! Framework developers reckon you need configuration for the executable file: be it a console, desktop, web, mobile app or something else. If you start providing configuration for a dll, you may end up with something I can call a config hell. You may no longer understand (easily) why this and that variables have such weird values coming seemingly from nowhere.
"Hold on", - you may say, "but I need this for my integration/unit testing, and it is a library!". And that is true and this is what you can do (pick only one, don't mix):
1. SlowCheetah - transforms current config file
You can install
- a Visual Studio plug-in that does all low level XML poking (or transformation) for you. The way it works, briefly:
Install SlowCheetah and restart Visual Studio (Visual Studio > Tools > Extensions and Updates ... > Online > Visual Studio Gallery > search for "Slow Cheetah" )
Define your solution configurations (Debug and Release are there by default), you can add more (right click on the solution in Solution Explorer > Configuration Manager... > Active Solution Configuration > New...
Add a config file if needed
Right click on config file > Add Transform
This will create Transformation files - one per your configuration
Transform files work as injectors/mutators, they find needed XML code in the original config file and inject new lines or mutate needed value, whatever you tell it to do
2. Fiddle with .proj file - copy-renames a whole new config file
Originally taken from . It's a custom MSBuild task that you can embed into Visual Studio .proj file. Copy and paste the following code into the project file
&Target Name="AfterBuild"&
&Delete Files="$(TargetDir)$(TargetFileName).config" /&
&Copy SourceFiles="$(ProjectDir)\Config\App.$(Configuration).config"
DestinationFiles="$(TargetDir)$(TargetFileName).config" /&
Now create a folder in the project called Config and add new files there: App.Debug.config, App.Release.config and so on. Now, depending on your configuration, Visual Studio will pick the config file from a Config folder, and copy-rename it into the output directory. So if you had PatternPA.Test.Integration project and a Debug config selected, in the output folder after the build you will find a PatternPA.Test.Integration.dll.config file which was copied from Config\App.Debug.config and renamed afterwards.
These are some notes you can leave in the config files
&?xml version="1.0" encoding="utf-8"?&
&configuration&
&!-- This file is copied and renamed by the 'AfterBuild' MSBuild task --&
&!-- Depending on the configuration the content of projectName.dll.config
is fully substituted by the correspondent to build configuration file
from the 'Config' directory. --&
&/configuration&
In Visual Studio you can have something like this
3. Use scripting files outside Visual Studio
Each build tool (like , ) will provide capabilities to transform config file depending on the configuration. This is useful if you build your solution on a build machine, where you need to have more control on what and how you prepare the product for release.
For example you can use web publishing dll's task to transform any config file
&UsingTask AssemblyFile="..\tools\build\Microsoft.Web.Publishing.Tasks.dll"
TaskName="TransformXml"/&
&PropertyGroup&
&!-- Path to input config file --&
&TransformInputFile&path to app.config&/TransformInputFile&
&!-- Path to the transformation file --&
&TransformFile&path to app.$(Configuration).config&/TransformFile&
&!-- Path to outptu web config file --&
&TransformOutputFile&path to output project.dll.config&/TransformOutputFile&
&/PropertyGroup&
&Target Name="transform"&
&TransformXml Source="$(TransformInputFile)"
Transform="$(TransformFile)"
Destination="$(TransformOutputFile)" /&
本文地址: &
我有一个包含MSTest集成测试的 dll类型项目。在我的机器上的测试通过,我想要在CI服务器上发生相同的(我使用TeamCity)。但是测试失败,因为我需要调整app.config中的一些设置。这是为什么我想要有一个单独的第二个app.config文件,将保存CI服务器的设置。
所以我想有
app.config(我认为这是VS要求的) app.Release.config (这是一个独立的独立配置文件)
因此,如果我选择释放配置在CI配置中,我想使用应用程序。 Release.config file instead of app.config
这似乎并不简单.dll类型项目。对于web项目,我可以做Web配置转换。我发现一个黑客如何做一个dll类型项目的这些转换,但我不是黑客的大粉丝。
根据.NET项目的构建配置(例如Debug,Release,...),调整app.config文件的标准方法是什么?
解决方案 使用
- 一个Visual Studio插件,为您执行所有低级别的XML戳(或转换)。它的工作原理简要:
***SlowCheetah并重新启动Visual Studio(Visual Studio>工具>扩展和更新...> Visual Studio Gallery>搜索“Slow Cheetah”)
定义您的解决方案配置(默认情况下,会显示调试和发布您可以在解决方案资源管理器> 配置管理器... >
Active Solution Configuration
添加配置文件
右键点击配置文件>添加变换
这将创建转换文件 - 每个配置一个
将文件转换为注入器/
2。转换.proj文件 - 复制重命名一个全新的配置文件
最初取自。它是一个自定义的MSBuild任务,您可以将其嵌入Visual Studio
.proj 文件中。将以下代码复制并粘贴到项目文件中
& Target Name =“AfterBuild”& & Delete Files =“$(TargetDir)$(TargetFileName).config”/& & Copy SourceFiles =“$(ProjectDir)\Config\App. $(Configuration).config” DestinationFiles =“$(TargetDir)$(TargetFileName).config”/& & / Target&
现在在项目中创建一个名为 Config 并在其中添加新文件: App.Debug.config , App.Release.config 等。现在,根据您的配置,Visual Studio将从 Config 文件夹中选择配置文件,并将其重命名为输出目录。因此,如果您已经选择了 PatternPA.Test.Integration 项目和 Debug 配置,则在构建之后的输出文件夹中,您会找到一个PatternPA.Test.Integration。 dll.config 文件,该文件从 Config\App.Debug.config 中复制并重命名。
这些是您可以在配置文件中留下的一些注释
&?xml version =“1.0”encoding =“utf -8“? & configuration&
&! - 此文件由'AfterBuild'MSBuild任务复制并重命名 - &
&! - 根据配置,projectName.dll.config 的内容完全被替换为从'Config'目录中构建配置文件。 - &
& / configuration&
在Visual Studio中可以有这样的
3。在Visual Studio之外使用脚本文件
每个构建工具(如,)将提供转换配置文件的功能取决于配置。如果您在构建机器上构建解决方案,您需要更多地控制哪些内容以及如何准备发布产品,这将非常有用。
使用web发布dll的任务来转换任何配置文件
& UsingTask AssemblyFile =“.. \tools\build\ Microsoft.Web.Publishing.Tasks.dll“ TaskName =”TransformXml“/&
& PropertyGroup& &! - 输入配置文件的路径 - & & TransformInputFile& app.config的路径& / TransformInputFile& &! - 转换文件的路径 - & & TransformFile&应用程序的路径$(配置).config& / TransformFile& &! -
outptu web配置文件的路径 - & & TransformOutputFile&输出project.dll.config的路径& / TransformOutputFile& & / PropertyGroup&
& Target Name =“transform”& & TransformXml Source =“$(TransformInputFile)” Transform =“$(TransformFile)” Destination =“$(TransformOutputFile)”/& & / Target&
本文地址: &
扫一扫关注官方微信CONFIG,最全面的CONFIG文章 - 电子工程世界网
在电子工程世界为您找到如下关于“CONFIG”的新闻
CONFIG资料下载
........\\.............\\....................\\........\\KE26XX Config Source & Measure.vi
........\\.............\\....................\\........\\KE26XX Factory Pulse Script Usage.vi...
NVRAM中的配置router# reload 重启路由器router# config terminal 从特权模式进入配置模式router(config)# hostname r1 配置用户名为r1router(config)# #banner welcome# 配置开机话语router# show controllers serial 0 查看串口0的物理层信息,主要是查看DTE...
config说明...
proe config 大全……...
trace工具抓取手机界面使用工具Catcher抓取手机界面方法:1. 手机上打开catcher功能: 使用暗码进入到工程模式(*#3646543#),选择设备,选择设置串口,选择uartsetting,此项中有三项,TTS-PS config,PS config,TST-L1 config,把TTS-PSconfig改为串口1,PS...
用ARM加载FPGA(附源代码),config……...
PCM Config Utility.xls...
startup-config 删除配置文件(2500系列路由器)
  #del flash:vlan.dat 删除Vlan配置信息(交换机)
  #Configure terminal 进入全局配置模式
  (config)# hostname switchA 配置设备名称为switchA
  (config)#banner motd & 配置每日提示信息 &为...
  交换机基本状态:  switch: ;ROM状态, 路由器是rommon&  hostname& ;用户模式  hostname# ;特权模式  hostname(config)# ;全局配置模式  hostname(config-if)# ;接口状态  交换机口令设置:  switch&进入特权模式  switch#进入...
mplayer,按wlan 0-1秒为 暂停,2-5秒为下一首或换台,按住6秒以上关闭mplayer
DB120 WLAN键控制mplayer示例
/etc/config/system添加如下内容
config \'button\'
option \'button\' \'BTN_1\'
option \'action\' \'released\'
CONFIG相关帖子
我用PIC16F54做了个按键扫描切换数码管显示的程序,数码管采用74HC164驱动,显示程序测试过了,单独的每一页都能正常显示,但一加按键程序就没反应了,朋友们,帮忙看看到底是哪的问题。
/*********PIC16F54控制数码管显示,电机调速**********/
#include &pic.h&
__CONFIG(HS&WDTDIS);
#define...
1、关于FLASH时钟的选择,此烧写工具默认最高频率进行FLASH的操作。根据目标系统的工作主频重新要进行PLL设置。方法:先在advance options下面的View Config file中修改倍频。存盘后,在相应的目录下(tic2xx\\algos\\相应目录)运行buildall.bat就可以完成修改了。再进行相应的操作即可。
2、若是你所选的频率不是最高频率,还需要设定...
=#999999]会飞的石头人 发表于
13:28[/color][/url][/size]
可是它们都是寄存器啊,都有八位[/quote]
先不说你的代码具体是怎么样的,做个假设下边的代码是一个例子,config和voltage都是uint8长度,config对应有3种配置,分别是转速、重启和电源开关,通过set设置
config是一个联合体,其中的all和set共用一个字节...
; & 背面图,有Wio Links everything字样& & & & 为什么看到红色的板子,第一反应就是TI呢,呵呵哒。板子做的还是很漂亮的
二 硬件资源& & 上wio Link管网图三 测试开始& & 我测试的目标是把Wio Link当成无线路由器使用,默认固件,长按config button,看...
玩5S,下的自然是安卓的APP
按照提示,选择WIO LINK,然后是下图画面:
我是水星555,选择后出现下面的画面:
这块得强调一下:不是等着就完事了,要手动按住,板子上的CONFIG按键,
当看到蓝灯象呼吸灯一样的就算行了。
然后出现如下的画面:
选择:WIO LINK - CD881,又出现如下画面:
然后点开始:
我就用上边那个作为名字点选那个灯泡:
点住脱到...
;IP renewed, DHCP config space reset
大部分情况下不必去核对这些状态报告代码,除非以下情况:
当使用DHCP客户端来配置协议栈,DHCP客户端控制CFGTAG_SYSINFO标签空间的前256个入口。这些入口与这256个DHCP操作标签通信。应用程序可以检查DHCPCODE_IPADD或者DHCPCODE_IPRENEW返回代码以便它能够读或者改变通过DHCP...
= 0;132 }133 134 void initUART(void) {&&135& && && &//config P1.1 RXD, P1.2 TXD136& && && &P1SEL |= TXD + RXD;137& & ...
;&// clear and start the timer, up mode 92 } 93 94 void initUART(void) {&& 95& &&&//config P1.1 RXD, P1.2 TXD 96& &&&P1SEL |= TXD + RXD; 97 ...
1.失败状况如下: 在驱动***没错,(板子插进去usb自动***完成):config选的MCU也没错的情况下出现如图错误:The debugging session could not be started...&&和 Failed to initialize device2.解决方法: 使用TI的官方Flash下载软件即可& &将IAR工程输出的hex文件...
2.2 _HEAP_SIZE未定义(1) 问题解决了上述问题,重新make,编译通过,但链接出错,错误提示如下:图4 _HEAP_SIZE未定义报错(2) 解决透过链接的提示信息可以得知,问题出在IAR的链接控制脚本,找到该脚本(我的路径是D:\IAR Systems\Embedded Workbench 6.0 Evaluation\430\config\lnk430f169.xcl)。这里...
CONFIG视频
你可能感兴趣的标签
热门资源推荐

参考资料

 

随机推荐