Issue Building a single project using msbuild that has multiple configurations

前端 未结 5 655
臣服心动
臣服心动 2021-02-06 23:14

Issue

We are using config transforms inside our solution. For example: Debug, Test, Staging, Release However, those configurations are only used on our

相关标签:
5条回答
  • 2021-02-06 23:59

    Using the tfs online I got the same error, this fixed my problem

    0 讨论(0)
  • 2021-02-07 00:00

    Unfortunately, you will have to modify every project that is used in the solution to have the same build path.

    However, this is a pretty easy thing to do if your projects all build to the same path regardless of configuration: in the project properties' Build tab, select All Configurations from the Configuration dropdown and then change the Output path.

    This will create entries for all of the configurations in the project file that do not already existing and set the same output path for all configurations.

    0 讨论(0)
  • 2021-02-07 00:11

    Would setting the switch/property /p:OutputPath=Test work for you? It would output the dlls in a directory called Test (I guees you also could use TeamCity variables). Link to similar question/answer https://stackoverflow.com/a/1083362/90033

    0 讨论(0)
  • 2021-02-07 00:11

    Put an OR condition for the different values on Release for as many different configurations that you have.

    eg.

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' Or '$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin\Release\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
    
    0 讨论(0)
  • 2021-02-07 00:11

    One simple solution would be to add a new property to your projects called "DeploymentConfiguration" and have it do the mapping between configs. Example:

      <!-- this is your non-deployment DLL -->
      <!-- Default DeploymentConfiguration to 'Debug' -->
     <DeploymentConfiguration Condition="'$(DeploymentConfiguration)'==''">Debug</DeploymentConfiguartion>
     <Configuration Condition='$(DeploymentConfiguration)'=='Test'">Debug</Configuration>
    

    Then in your MSBuild invocation, pass in

     /p:DeploymentConfiguration=Test
    

    In your deployment MVC you'd just assign DeploymentConfiguration through to Configuration directly.

    0 讨论(0)
提交回复
热议问题