开发者

How can I publish a transformed configuration file?

开发者 https://www.devze.com 2023-03-24 12:27 出处:网络
I have a config file (say myprogram.exe.config) inside a Visual Studio C# web project inside a folder called Tools. Something like this.

I have a config file (say myprogram.exe.config) inside a Visual Studio C# web project inside a folder called Tools. Something like this.

MySolution
    MyWebProject
        Tools
            myprogram.exe
            myprogram.exe.config
                myprogram.exe.debug.config
                myprogram.exe.release.config

I was able to successfully transform the config file based on the configuration (debug or release) by adding this to my .csproj file:

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Tar开发者_JS百科get Name="AfterCompile" Condition="exists('Tools\myprogram.exe.$(Configuration).config')">
        <TransformXml Source="Tools\myprogram.exe.config" Destination="$(IntermediateOutputPath)myprogram.exe.config" Transform="Tools\myprogram.exe.$(Configuration).config" />
</Target>

This causes the transformed myprogram.exe.config file to be put in the folder: MyWebProject\obj\debug

However I do not understand how to move it from here and put it in the appropriate output folder. If I choose "Publish" by right clicking on MyWebProject, the appropriate folder is MyWebProject\bin\Tools.

I am using Visual Studion 2010 and this is an ASP.NET MVC3 web application I am working with. Also in the same solution is an Azure deployment project.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消