The OutputPath property is not set for project

Solution 1:

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 ...

Solution 2:

Open up your csproj in a text editor and see if you have a property group section, should look something like this:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Latest|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Latest\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

Do you have a 'Latest' build configuration? If not add the above section to the csproj.

Solution 3:

As mentioned by perlyking, rather than editing the csproj XML The following worked for me. Here are the steps I used.

  1. Open the Project Properties.
  2. Select the Build Tab.
  3. Under the Output section, Check that an output path is set. (if not set one, save the project and it should work).
  4. If it is set, click on the "Browse..." button of the output path.
  5. When the folder selection dialog opens, Navigate up one level in the file browser and then re-select the output folder and click the "Select Folder" button.
  6. Save the project properties and it should work.

Solution 4:

To add to what @James said, I found that if I looked at the project Compile properties in VS2013, the Build Output Path was specified. But when I examined the .csproj file directly, the OutputPath element was missing for the relevant build configuration. So in VS I simply made and reversed a minor edit to the output path, saved it, and that kicked the value into the project file, and I was then able to build.