Build Event不会创建转换后的Web配置 [英] Build Event is not creating the transformed web configs

查看:85
本文介绍了Build Event不会创建转换后的Web配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试为我的服务项目生成webconfig转换,我做了以下事情。



1。创建转换环境,如DEV,QA,PROD,STG,并创建适当的配置转换。

< client> 
< endpoint address = xyz.abc.svc
binding = basicHttpBinding bindingConfiguration = BasicHttpBinding_Iabc
contract = Ax5BusinessService.Iabc name = BasicHttpBinding_Iabc xdt:Transform = 替换 xdt:Locator = 匹配(名称) />
< / 客户 >





2.创建发布配置文件

 <  项目    ToolsVersion   =  4.0    xmlns   =  http: //schemas.microsoft.com/developer/msbuild/2003\">  
< PropertyGroup >
< ; WebPublishMethod > FileSystem < / WebPublishMethod >
< LastUsedBuildConfiguration > 发​​布< span class =code-keyword>< / LastUsedBuildConfiguration >
< LastUsedPlatform > 任何CPU < / LastUsedPlatform >
< SiteUrlToLaunchAfterPublish / >
< LaunchSiteAfterPublish > True < / LaunchSiteAfterPublish >
< ExcludeApp_Data > False < / ExcludeApp_Data >
< publishUrl > F:\\\\\\\\\\\\\\\\\\\\\\\ / span> / publishUrl >
< ; DeleteExistingFiles > True < / DeleteExistingFiles >
< / PropertyGroup >
< < span class =code-leadattribute> / Project >





3.添加批处理文件



setlocal

set ProjectDir =%1

set SolutionDir = %2



调用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





endloca l




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



现在如果我通过命令提示符执行bat状态,它会准备正确的转换网络配置



现在我想编写构建语句,以便在生成后将它们正确复制到适当的文件夹

PRE BUILD

  if  '  $(TeamBuild)' == '  True'退出 0  

如果 $(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

 f '  $(TeamBuild)' == '  True'退出 0  

if $(ConfigurationName) == StagingMSI
mkdir < span class =code-s tring> $(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)\ .. \\\ * .dll $(SolutionDir)\ InstallPackages \ QA \ $(ProjectName)\ bin / Y
xcopy $(ProjectDir)\..\\\\ * .dll $(SolutionDir)\ InstallPackages\STG \ $(ProjectName)\ bin / Y
xcopy $(ProjectDir)\..\bin\ * .dll $(Soluti) onDir)\ InstallPackages\PROD \ $(ProjectName)\ bin / Y





这样做什么都没有...当我填写参数并在命令promt上执行时,它确实不是没有使用构建命令。



你能指导。

解决方案

(TeamBuild)' == ' 真'退出 0

如果


(ConfigurationName) == StagingMSI

rmdir

(SolutionDir)\..\InstallPackages\DEV\

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.

<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

<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

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

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.

解决方案

(TeamBuild)'=='True' exit 0 if "


(ConfigurationName)"=="StagingMSI" ( rmdir "


(SolutionDir)\..\InstallPackages\DEV\


这篇关于Build Event不会创建转换后的Web配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆