creating a targeted OBJ folder for a project in Visual Studio

こ雲淡風輕ζ 提交于 2019-12-21 10:16:13

问题


Is it possible to create a targeted OBJ file path much like you can do for a BIN folder? You can set the output path in the Project's properties. Example paths would be: Bin\Debug\Windows Phone 7\ Bin\Debug\NETMF\ Bin\Debug....\

A use case here is if I have multiple projects that target different platforms. On compiling, the OBJ file is shared instead of separated out like the bin folders are. When compiling, you hit race conditions where the OBJ folder is being leveraged at the same time and errors are thrown.


回答1:


Here we're talking about MSBUILD, and you have the option of setting BaseIntermediaryOutputPath in your project. If you open the project (.csproj, I am assuming) with an XML editor, you will see configuration blocks for different debug/release config combos.

So something like this (edit for each config option separately):

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A35097D8-80BC-4FA5-BECD-FF045C5566EC}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>WorkApplication</RootNamespace>
    <AssemblyName>WorkApplication</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <BaseIntermediateOutputPath>E:\OBJ-TEST</BaseIntermediateOutputPath>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>


来源:https://stackoverflow.com/questions/12656475/creating-a-targeted-obj-folder-for-a-project-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!