Click here to Skip to main content
15,886,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello all,
I am trying to generate the webconfig transformation for my service project and i did following things.

1. created the transformation environment like DEV,QA,PROD,STG and created proper config transformations.
C#
<client>
    <endpoint address="xyz.abc.svc"
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Iabc"
      contract="Ax5BusinessService.Iabc" name="BasicHttpBinding_Iabc" xdt:Transform="Replace" xdt:Locator="Match(name)" />
  </client>


2. Created the publish profile
HTML
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>F:\k\j\Service</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
  </PropertyGroup>
</Project>


3. Added the batchfile

setlocal
set ProjectDir=%1
set SolutionDir=%2

call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
cd %ProjectDir%


msbuild Enterprise.d5.Service.csproj /T:Clean,build /p:DeployOnBuild=True /p:TeamBuild=True /T:TransformWebConfig /p:Configuration=DEV /p:PublishProfile=PublishAX5 /p:VisualStudioVersion=11.0 /p:PublishUrl="InstallPackages\DEV\Enterprise.d5.Service"


endlocal


--------------------------

now if i execute the bat statment via command prompt it prepares proper tranformed web configs

now i want to write build statement so that these get copy properly to appropriate folder after getting generated
PRE BUILD
JavaScript
if '$(TeamBuild)'=='True' exit 0

if "$(ConfigurationName)"=="StagingMSI" (

rmdir "$(SolutionDir)\..\InstallPackages\DEV\$(ProjectName)"
rmdir "$(SolutionDir)\..\InstallPackages\QA\$(ProjectName)"
rmdir "$(SolutionDir)\..\InstallPackages\STG\$(ProjectName)"
rmdir "$(SolutionDir)\..\InstallPackages\PROD\$(ProjectName)"
)


POST BUILD
i
JavaScript
f '$(TeamBuild)'=='True' exit 0

if "$(ConfigurationName)"=="StagingMSI" (
mkdir "$(SolutionDir)\..\InstallPackages\DEV\$(ProjectName)"
mkdir "$(SolutionDir)\..\InstallPackages\QA\$(ProjectName)"
mkdir "$(SolutionDir)\..\InstallPackages\STG\$(ProjectName)"
mkdir "$(SolutionDir)\..\InstallPackages\PROD\$(ProjectName)"

xcopy $(ProjectDir)\..\bin\*.dll $(SolutionDir)\InstallPackages\DEV\$(ProjectName)\bin /Y
xcopy $(ProjectDir)\..\bin\*.dll $(SolutionDir)\InstallPackages\QA\$(ProjectName)\bin /Y
xcopy $(ProjectDir)\..\bin\*.dll $(SolutionDir)\InstallPackages\STG\$(ProjectName)\bin /Y
xcopy $(ProjectDir)\..\bin\*.dll $(SolutionDir)\InstallPackages\PROD\$(ProjectName)\bin /Y

)


This is doing nothing... when i fill the parameters and excute on command promt it does well not not with build command.

Can you please guide.
Posted
Updated 6-Apr-15 0:36am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900