views:

257

answers:

1

How can I define project OutputPath in a solution file?

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugUse|AnyCPU' ">
  <DebugSymbols>true</DebugSymbols>
  <OutputPath>bin\Debug\</OutputPath> <!-- this -->
  <DefineConstants>DEBUG;TRACE</DefineConstants>
  <DebugType>full</DebugType>
  <PlatformTarget>AnyCPU</PlatformTarget>
  <ErrorReport>prompt</ErrorReport>
</PropertyGroup>

Alternatively, I think I could use a custom project property.

<OutputPath>$(SolutionOutputPath)\Debug\</OutputPath>

But I don't know how define custom project properties in a solution file. I was trying something like:

Project(...) = ...
    ProjectSection(ProjectProperties) = preProject
        OutputPath = "C:\Test\Bin"
    EndProjectSection
EndProject
+1  A: 

I'm fairly sure this isn't possible. The solution file just references project files, so all project-specific options such as output paths and so on, must be contained within the referenced project file.

Nik
You can specify WebSite properties inside a solution file:ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.VirtualPath = "/web" Debug.AspNetCompiler.PhysicalPath = "src\web\" ...EndProjectSectionSo, it might be possible to specify other project properties.
TN
After reflectoring how MSBuild parses the solution file. I found that it is not possible.
TN
Good point on the WebsiteProperties section, but as far as I can see, that's a bit of an anomaly when compared to the rest of the build system.
Nik