“未为此项目设置 outputpath 属性”错误

我在 VisualStudio2008中有一个多项目解决方案。我刚刚在解决方案中添加了一个名为 ReleaseVersionIncrement 的新 Configuration,指定“ use release”配置作为基线。所有项目文件都使用该配置进行了更新。然而,当我尝试使用这个配置来编译一个特定的项目时,我会得到以下错误:

错误5 OutputPath 属性不是 为此项目设置。请检查到 确保您已指定了一个 有效的配置/平台 密码。 配置 = “发布-版本增量” Platform = ‘ AnyCPU’C: WINDOWS Microsoft.NET Framework v3.5 Microsoft. Common.target 5399数据转换

这里发生了什么? 该项目在发布或调试配置中编译良好。

94322 次浏览

Usually this happens when the OutputPath property of the project file is blank. Project files are just MSBuild files. To edit in Visual Studio: Right click on the project, pick "Unload project" then right click on the unloaded project and select "Edit ...".

Look for the Release-Versionincrement property group. It should look something like

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-VersionIncrement|AnyCPU' ">
<OutputPath>bin\Release-VersionIncrement\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>

The important one there it the OutputPath, does it exist for your project file? If not add it and try again.

The issue had to do with my project configuration. Here is the scenario:

Solution A references:

Project X references Project Y
Project Y

Solution B (the one I am trying to build) references:

Project X Project Z

My solution was to create a configuration with the same name for Solution A, rebuild it, and then rebuild Solution B. This fixed the problem.

I had the same problem when I used MSBuild first. My solution is: use the OutputPath property definitely. Like this:

msbuild XXX.csproj /p:OutputPath=bin\Debug.

I have also seen this error when our build agent was configured to run platform "Any CPU" (with spaces as displayed in Visual Studio) rather than "AnyCPU" (one word as specified in the project file).

In my case the OutputPath was set property in the project files. But unloading, reloading and then rebuilding fixed it.

I've removed Platform environment variable (was BNB or smth like that). The problem is gone.

I strugged with this for a while and then also unloaded, built, and then reloaded the offending project in the solution, and then MSBuild functioned correctly.

Like "Richard Dingwall" hinted, the problem is related to VS using the display version of "Any CPU" instead of the MSBuild version which actually reads "AnyCPU"

Go into Build/New Build Definition or Edit Build Definition -> Process -> Configurations to build, open the configuration selection dialog and in "Platform" instead of selecting "Any CPU", manually add "AnyCPU"

In our case we were running a build script on our HP developer boxes. HP have some environment variables they've set up for their own purposes and one of them is PLATFORM (used, apparently, for "HP Easy Setup").

Deleting the PLATFORM environment variable worked.

You could also future-proof your build script by specifying the platform, i.e.
msbuild /p:Platform=AnyCPU.

I had this same error message. It was caused by having a reference to a project that was unloaded and not required by the linker (otherwise it would have failed at compile time). Removing the offending reference solved the issue.

In my case the new "PropertyGroup" XML block was generated at the bottom of document. I've just replaced it after other "PropertyGroup" tags and this resolved the problem.

I was adding the x64 platform to my solution today, when I ran into this issue.

In my case, the error read:

Built $/ProjectDirectory/ProjectName.csproj for default targets. c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (484): 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='Debug' Platform='x64'. 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.

I knew the OutputPath should be fine, since this was an existing, working VS solution. So I moved to the next hint--"a valid combination of Configuration and Platform".

Aha! Visual Studio is trying to build Configuration='Debug', Platform='x64'. Looking at my project file, I realized that x64 was not listed as one of the possible platforms. In other words, I had the below entries (shortened):

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Debug\</OutputPath>
. . .
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
. . .
</PropertyGroup>

Easy fix then: just add x64 entries!

I copy/paste'd the x86 entries, and changed them to use x64. Notice I also modified the paths so these don't overwrite x86 builds:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Debug\</OutputPath>
. . .
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
. . .
</PropertyGroup>

In my case (VS2010) I removed string in the "OutputPath" box that is on "Build" tab and left it blank. Then I rebuilt the solution. Build was successful and VS has inserted current directory "./" into the "OutputPath". I replaced current directory "./" with my path ("bin\x64\Release\" -- suffice to say that this is exact folder path that was VS was complaining in the first place) and rebuild was successful again.

I created a new project in a new solution which references to existing projects. This error occurs when I add an existing project (say project 1) and try to build without adding other projects that project 1 references to.

Just make sure all the relating projects are added to the new solution and the error disappears.

If Visual Studio specifically complains that "Platform='BPC'" then you can easily fix this by removing the "Platform" environment variable.

Delete this bad boy.

Now restart Visual Studio and you are good to go.

I had the same error, so I looked on project settings and there in "Build" section is "Build output path" option. And value was empty. So I filled in "bin\" value a error disappeared. It solved my problem.

As was said, OutputPath must be set AND it must be placed before <Import Project="$(WixTargetsPath)" /> in .wixproj file

As Scott S, I've had to delete the "Platform" environment variable.

Then restart VS, and it's ok : no more error message...

If you decide to set OutputPath as a param, and your path is like: bin\Release\\ then remember to add \ at the end like that: /p:OutputPath=bin\Release\\\\ it took me a while to realize it was the case

I had the same problem. I fixed it by clean and rebuilt the projects.

I had the same problem, and the only solution that helps was to set the Build Configuration Manually in each NCrunch Project.

Open the NCrunch Window, where you can see the Status of each Build and where you can see that the build failes. Right click on the project that fails to build and click on "configure selected component" there you see under "Build Settings" the property "Use build confoguration" set it to e.g. "Debug" and the property "Use build platform" set it to e.g. "AnyCPU". (Please note that the build and configuration settings you set must exist in your konfigration Settings)

Do this for all of your projects, but not for your test project. After this everything works fine for me.

I had the same problem, I fixed it by adding missing Configurations to the project that was failing.

BUILD -> Configuration Manager ->

Under Configuration Column Add

Note: This only happened to be because I have custom configuration and newly created projects didn't have the configuration.

If anyone is getting this one in his NCrunch logs, check if the PropertyGroup defining the values 'Debug'/'Release' and 'AnyCPU'/'x86' located before the property groups using those values in their condition.

<PropertyGroup>
<!-- this one first -->
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<XXX>...</XXX>
</PropertyGroup>


<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<XXX>...</XXX>
</PropertyGroup>


<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<XXX>...</XXX>
</PropertyGroup>

Worked for me.

In my case, I tried to move the property group that contained my custom configuration down below the standard ones. It solved it for me.

When I added new solution configuration in my solution, I got an error, "The OutputPath property is not set for project X. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='QA' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. ProjectY".

In my case issue was due to highlighted part of the error description. Project X part of my solution was having a project reference to ProjectY of another solution(different branch).

I've resolved this issue by modifying project X to use project reference to ProjectY in the current solution. Hope this helps someone having similar issue.

Just had this with VS2015 Professional:

The OutputPath property is not set for project 'xxxxx.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.

This is also multi-project juggling between debug/release and different targets. I had been fiddling with build configurations at some point and I know that can mess up VS, so I pulled them back from the repo. Still no good. OutputPath was set, there were no longer any diffs with a known good state so there was definitely something wrong with my local installation.

Opened up VS2015 installer and clicked "Repair", and voila... back to normal (so far at least!)

For me it was a line in the NuGet package configuration. Get rid of everything package related in your project file and see come back to life (save the edits). Than build it up again part by part. I brought it down to this line which I had to remove:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

I got the problem after an update of NuGet packages (mainly FxCop analyzer stuff).

For me it was my .csproj file having multiple groups

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

where

<OutputPath></OutputPath>

was empty.

Filled with bin\debug and the error went away.