问题
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:
An
OutputPath
in your project fileSpecifies 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.
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.
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 baseOutputPath
, 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