Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The OutputPath property is not set for project

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>
like image 285
Sachin Kainth Avatar asked Feb 28 '13 11:02

Sachin Kainth


3 Answers

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

like image 115
Saurabh Avatar answered Oct 12 '22 19:10

Saurabh


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.

like image 30
James Woolfenden Avatar answered Oct 12 '22 17:10

James Woolfenden


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.
like image 40
Bevan Avatar answered Oct 12 '22 18:10

Bevan