Hi, You have a few choices, you can use this Visual Studio Add-in:
http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5 or edit the .csproj to include the following lines and insert the following lines immediately before the last </Project> this swaps the contents of the .config after compile. <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" /> <Target Name="AfterCompile" Condition="exists('app.$(Configuration).config')"> <!-- Generate transformed app config in the intermediate directory --> <TransformXml Source="app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" /> <!-- Force build process to use the transformed configuration file from now on. --> <ItemGroup> <AppConfigWithTargetPath Remove="app.config" /> <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config"> <TargetPath>$(TargetFileName).config</TargetPath> </AppConfigWithTargetPath> </ItemGroup> </Target> You must have your transforms stored in App.<configuration name>.config like this: [Description: C:\Users\WMA~1.LIK\AppData\Local\Temp\SNAGHTML6275dc8.PNG] The App.<configuration name>.config must at a minimum contain the following: <?xml version="1.0"?> <!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> </configuration> Here is an example of our app.lab.config <?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <connectionStrings xdt:Transform="Replace"> <add name="TailspinConnectionString" providerName="System.Data.SqlClient" connectionString="data source=(local);User Id=sqluser;Password=pass@word1;initial catalog=TailspinToys;multipleactiveresultsets=True;" /> </connectionStrings> </configuration> Does that help? Wes Wes MacDonald LIKE 10 INC.<http://www.like10.ca/> 1150 - 45 O'Connor Street Ottawa, ON K1P 1A4 Microsoft MVP: Visual Studio ALM<https://mvp.support.microsoft.com/profile/Wes.MacDonald>, MCTS, MCITP (SharePoint 2010) Blog<http://blogs.like10.com/> | Mobile: +1.613.219.7841 | Office: +1.613.755.4055 | Lync<sip:[email protected]> | Email<mailto:[email protected]> | about.me<http://about.me/wesmacdonald/bio> | Twitter<http://twitter.com/wesmacdonald> "Risk comes from not knowing what you're doing. " -- Warren Buffet From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Sniderman Sent: December-28-11 1:32 PM To: [email protected] Subject: TFS 2010 Build Issue modifying app.config While I know WIX is supposed to be the way to go - I've been hoping I can avoid learning it for now and continue to use the setup process using Visual Studio Setup Projects by the well documented process to run devenv to create the MSI file using the VS Setup Project. This is for a Windows Forms Application. The issue I can't figure out how to get around - some process seems to put a "lock" on the app.config file. I can successfully modify AssemblyInfo.cs all day long - but I'm trying to use the "TransformXML" MSBuild Task (I've tried both MSBuild Task and writing a custom task) I am successful transforming the file - but I need to copy it back over the "app.config" in the source tree - so when devenv.exe invokes to create the MSI file - it has the modified one. But every method of trying to overwrite the "app.config" shows that the file is in use. Any idea what is holding on to that file and why I can't overwrite it? I'm currently using a modified "Default" Xaml Workflow and doing it after the "Get Workspace" task (naturally). Daniel P. Sniderman| Sr Consultant| Magenic MCSD.NET, MCTS: Team Foundation Server 2010 Administration 333 E. Butterfield Rd. Suite 100, Lombard, IL 60148 Mobile: 847-668-4882 | eFax 847-390-7810 magenic.com | [email protected]<mailto:[email protected]>
<<inline: image001.png>>
_______________________________________________ oztfs mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/oztfs
