将csproj文件配置移到其他文件

时间:2020-06-24 15:29:10

标签: visual-studio

VS自动在csproj中设置我的配置。我也可以从那里修改它们,但是最后一次此文件的确非常糟糕。有什么方法可以将此文件移动到另一个在构建解决方案时不会被覆盖的文件中,更干净吗?类似于myConfig.cs

我使用这些配置来设置我正在加载的参考的版本。我将Revit用作运行应用程序的外部软件,因此很多次我必须切换Revit的DLL版本才能获得正确的版本。我有兴趣仅包含此信息。

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == '2019|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\2019\</OutputPath>
    <DefineConstants>2019</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == '2018|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\2018\</OutputPath>
    <DefineConstants>2018</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == '2020|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\2020\</OutputPath>
    <DefineConstants>2020</DefineConstants>
    <DebugType>full</DebugType>
  </PropertyGroup>



    <Reference Include="RevitAPI" Condition="'$(Configuration)' == '2018'">
      <HintPath>C:\Program Files\Autodesk\Revit 2018\RevitAPI.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="RevitAPIUI" Condition="'$(Configuration)' == '2018'">
      <HintPath>C:\Program Files\Autodesk\Revit 2018\RevitAPIUI.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="RevitAPI" Condition="'$(Configuration)' == '2019'">
      <HintPath>C:\Program Files\Autodesk\Revit 2019\RevitAPI.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="RevitAPIUI" Condition="'$(Configuration)' == '2019'">
      <HintPath>C:\Program Files\Autodesk\Revit 2019\RevitAPIUI.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="RevitAPI" Condition="'$(Configuration)' == '2020'">
      <HintPath>C:\Program Files\Autodesk\Revit 2020\RevitAPI.dll</HintPath>
      <Private>False</Private>
    </Reference>

在任何文档/样本中可以看到如何执行此操作? 其他解决此问题的建议?

谢谢

0 个答案:

没有答案