0

I am working on msuild and trying to implement web.config transformation via msbuild scripts.i have added extra web.staging.config and web.production.config.when i am trying to run target using command line like msbuild tweb.xml /t:tw /p:Configuration=staging;Platform=AnyCPU

getting below error.pls help me,what mistake i am doing???

"E:\tweb.xml" (tw target) (1) ->
(_CheckForInvalidConfigurationAndPlatform target) ->
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483,9)
: error : The OutputPath property is not set for project 'tweb.xml'.  Please ch
eck to make sure that you have specified a valid combination of Configuration a
nd Platform for this project.  Configuration='staging'  Platform='AnyCPU'.  You
 may be seeing this message because you are trying to build a project without a
 solution file, and have specified a non-default Configuration or Platform that
 doesn't exist for this project. [E:\tweb.xml]

0 Warning(s)
1 Error(s)

Below is my code

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'staging|AnyCPU'">
    <WebConfigReplacement>staging</WebConfigReplacement>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'production|AnyCPU'">
    <WebConfigReplacement>production</WebConfigReplacement>
  </PropertyGroup>





  <PropertyGroup>
    <TransformInputFile>D:\webTransdemo\deploye\Web.Temp.config</TransformInputFile>
    <TransformFile>D:\webTransdemo\WebTransform\WebTransform\Web.$(WebConfigReplacement).config</TransformFile>
    <TransformOutputFile>D:\webTransdemo\WebTransform\WebTransform\Web.config</TransformOutputFile>
    <StackTraceEnabled>False</StackTraceEnabled>
  </PropertyGroup>

  <ItemGroup>
    <OriginalWebConfig Include="D:\webTransdemo\WebTransform\WebTransform\Web.config"/>
    <TempWebConfig Include="D:\webTransdemo\deploye\Web.Temp.config"/>
  </ItemGroup>


  <Target Name="tw"  Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU' Or '$(Configuration)|$(Platform)' == 'Staging|AnyCPU'">

    <Copy SourceFiles="@(OriginalWebConfig)" DestinationFiles="@(TempWebConfig)" />

    <TransformXml               Source="$(TransformInputFile)"   
                                Destination="$(TransformOutputFile)"
                                Transform="$(TransformFile)"
                                StackTrace="$(StackTraceEnabled)" />
    <Delete Files="@(TempWebConfig)"/>


  </Target>
user2459106
  • 61
  • 1
  • 1
  • 8

1 Answers1

0

You need to set the OutputPath property.

<OutputPath>bin\</OutputPath>

In addition, your target will not be executed, since the configuration doesn't match the arguments you are passing in. Make sure the casing matches -

<Target Name="tw"  Condition="'$(Configuration)|$(Platform)' == 'production|AnyCPU' Or '$(Configuration)|$(Platform)' == 'staging|AnyCPU'">
Steve
  • 206
  • 2
  • 10