The OutputPath property is not set for project

Sachin Kainth picture Sachin Kainth · Feb 28, 2013 · Viewed 85.4k times · Source

Building my Jenkins/MSBuild solution gives me this error

c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483,9): error : 
The OutputPath property is not set for project '<projectname>.csproj'.  Please check to
make sure that you have specified a valid combination of Configuration and Platform 
for this project.  Configuration='Latest'  Platform='AnyCPU'.  You may be seeing this 
message because you are trying to build a project without a solution file, and have
specified a non-default Configuration or Platform that doesn't exist for this project. 
[C:\<path>\<projectname>.csproj]

Any ideas?

EDIT

I have this in my .csproj file

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Latest|AnyCPU'">
    <OutputPath>bin\Latest\</OutputPath>
  </PropertyGroup>

Answer

Saurabh picture Saurabh · Jul 25, 2017

I have figured out how it works (without changing sln/csproj properties in VS2013/2015).

  1. if you want to build .sln file:
    1. /p:ConfigurationPlatforms=Release /p:Platform="Any CPU"
  2. if you want to build .csproj file:
    1. /p:Configuration=Release /p:Platform=AnyCPU
      1. notice the "Any CPU" vs AnyCPU
  3. check the code analysis, fxcop, test coverage(NCover) targets, as well as the MSBUILD should be located properly. In my case its:
    1. C:\Windows\Microsoft.NET\Framework64\v4.0.30319 but it can be different as you can see microsoft has given 6 cmd options to build code base::AMD (with cross plt, x86 & x64 options) and Windows(cross, x86, x64) and that also when code development happened with default JIT (it can be PreJIT ngen.exe, econoJIT)

I think more than this troubleshooting can be handle using power shell + msbuild. May be helpful for someone ...