在我的 app.config 中,我有
<endpoint address="http://debug.example.com/Endpoint.asmx" stuff />
如何修改构建任务,以便在进行发布构建时将端点地址更改为
<endpoint address="http://live.example.com/Endpoint.asmx" stuff />
最佳答案
如果您的调试/发布配置分别命名为“调试”和“发布”,则应该这样做:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<endpoint address="http://debug.example.com/Endpoint.asmx" stuff />
<!-- other things depending on Debug Configuration can go here -->
</PropertGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<endpoint address="http://live.example.com/Endpoint.asmx" stuff />
</PropertGroup>
关于MSBuild 根据调试/发布版本更改配置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4712162/