Autogenerated IntermediateOutputPath in the .csproj file

混江龙づ霸主 提交于 2021-01-27 04:39:12

问题


After updating the code from Git I have an error in the csproj, because the file path doesn't exist. Here is the code which initiates the error:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ZAL_Release|x64'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>..\Release\bin\soft\</OutputPath>
    <DefineConstants>TRACE;ZAL</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x64</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
    <Optimize>true</Optimize>
    <IntermediateOutputPath>C:\Users\HARRY~1\AppData\Local\Temp\vs543E.tmp\x64\ZAL_Release\</IntermediateOutputPath>
</PropertyGroup>

This filepath exists on Harry's computer, but not on mine. The guy with this name has no idea how he created this, so I assume Visual Studio created it. That's why I have three questions:

1. What's the goal of IntermediateOutputPath tag in the csproj? (I already checked MSDN documentation, but still not clear)

2. How did Harry generat the code (because he doesn't know)?

3. Is it possible to use a generic variable to get a file path that everybody could use? In the case, is this IntermediateOutputPath mandatory for the program to run?


回答1:


  1. An OutputPath in your project file

    Specifies the path to the output directory, relative to the project directory, for example, "bin\Debug".

    The BaseOutputPath

    Specifies the base path for the output file. If it is set, MSBuild will use OutputPath = $(BaseOutputPath)\$(Configuration). Example syntax: c:\xyz\bin\

    The BaseIntermediateOutputPath

    The top-level folder where all configuration-specific intermediate output folders are created. The default value is obj. The following code is an example: c:\xyz\obj\

    The IntermediateOutputPath

    The full intermediate output path as derived from BaseIntermediateOutputPath, if no path is specified. For example, \obj\debug. If this property is overridden, then setting BaseIntermediateOutputPath has no effect.

    You can read this up here. In general these Paths should be relative and in no way lead to any home folders or other user-specific paths.

  2. See this question for an explanation of how the IntermediateOutputPath may have been inserted in your csproj file.

    EDIT: Actually, this is a vague explanation, but I could not find any other info about this. Keep an eye on changes on your csproj file to pin down the reason for the change.

  3. You can set IntermediateOutputPath to a relative path. You can, however, also just delete the whole tag and go with the default. In our Visual Studio 2015 project files, we only set the base OutputPath, and everything is working fine. I think the default place for your intermediate objects is /obj.



来源:https://stackoverflow.com/questions/42711214/autogenerated-intermediateoutputpath-in-the-csproj-file

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