可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
When I try to compile my project from x86 debug mode in Visual Studio 2008. I am getting this error. When I looked at the property group of the project that complained, I see output path is set.
Here is the property group section for that .csproj file
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
Can any one shed the light on this?
NOTE: When I compiled this Debug and Any CPU it worked.
UPDATED: Error 1 The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination. Configuration='Debug' Platform='x86'
回答1:
Had exact same error after adding new configuration via ConfigurationManager in VisualStudio.
Turned out when 'Production' configuration was added for whole solution (and each project) OutputPath element was not added to csproj files.
To fix this, I went to a Build tab of project properties, changed OutputPath from \bin\Production\
to \bin\Production
(deleted trailing \
) and saved changes. This forced creation of OutputPath element in csproj file and project built successfully.
Sounds like a glitch to me.
回答2:
You can see this error in VS 2008 if you have a project in your solution that references an assembly that cannot be found. This could happen if the assembly comes from another project that is not part of your solution but should be. In this case simply adding the correct project to the solution will solve it.
Check the References section of each project in your solution. If any of them has a reference with an red x next to it, then it you have found your problem. That assembly reference cannot be found by the solution.
The error message is a bit confusing but I've seen this many times.
回答3:
If you are using WiX look at this (there is a bug)
http://www.cnblogs.com/xixifusigao/archive/2012/03/20/2407651.html
Sometimes new build configurations get added to the .wixproj
file further down the file, that is, separated from their sibling config definitions by other unrelated XML elements.
Simply edit the .wixproj
file so that all the <PropertyGroup>
sections that define your build configs are adjacent to one another. (To edit the .wixproj
in VS2013 right click on project in Solution Explorer, Unload project, right-click again->Edit YourProject.wixproj. Reload after editing the file.)
回答4:
I encountered the same error but the problem turned out to be because I had created a new configuration in my solution that didn't exist in referenced assemblies from another solution.
This can be resolved by opening the related solution and adding the new configuration to it as well.
This post gave me the idea to check the referenced assemblies after I'd already confirmed that all projects within my solution had the correct configuration:
http://gabrielmagana.com/2010/04/solution-to-the-outputpath-property-is-not-set-for-this-project/
回答5:
The error shown in visual studio for the project (Let's say A) does not have issues. When I looked at the output window for the build line by line for each project, I saw that it was complaining about another project (B) that had been referred as assembly in project A. Project B added into the solution. But it had not been referred in the project A as project reference instead as assembly reference from different location. That location contains the assembly which compiled for Platform AnyCpu. Then I removed the assembly reference from the project A and added project B as a reference. It started compiling.
Not sure though how this fix worked.
回答6:
This happened to me because I had moved the following line close to the beginning of the .csproj file:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
It needs to be placed after the PropertyGroups that define your Configuration|Platform.
回答7:
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.
回答8:
Another crazy possibility:
If you follow a simple source control arrangement of putting Branch\Main, Main, and Release next to each other and you somehow end up adding an existing project from Main instead of Branch\Main (assuming your working solution is Branch\Main), you may see this error.
The solution is simple: reference the right project!
回答9:
I encountered this problem when adding a project to a solution then referencing it from yet another project in the same solution-- got the yellow warning icon over the reference, notice that path was empty.
The solution was similar to what @Amzath suggested, my projects were being compiled with different Target Frameworks, eg. .NET 4.0 vs 4.5.
回答10:
In my case the built address of my app was set to another computer that was turned off so i turned it on and restart VS and problem solved.
回答11:
I had the same problem after I have added new configurations and deleted the "debug" and "release" configs.
In my case I was using a cmd file to run the build and publish process, but the same error was thrown.
The solution for me:
In the csproj file the following:
<Configuration Condition=" '$(Configuration)' == '' ">Debug< /Configuration>
was setting the Configuration to "Debug" if I did not specify an explicit one. After changing the node value from "debug" to my custom configuration, it all worked smoothly. Hope this will also help whoever is reading this :)
回答12:
Another cause: you add a project reference from project A to project B in solution X. However, solution Y that already contains project A is now broken, until you also add project B to solution Y.
回答13:
I had the same problem,
Just edit the .wixproj to have all of the
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ... >
elements to be side by side.
That solved my issue
回答14:
I have:
- Right-click on project with issue -> Unload Project
- Right-click on project and choose Edit *.csproj
Copy-paste
the configuration from existing configuration which works with specific name and targeting platform (I had Release |
x64):
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
- Right-click project -> Reload Project
- Rebuild project/solution
回答15:
The WiX project I was using was hard-set in the configuration manager for x64
across the board. When making the Custom Action project for the solution, it defaulted everything to x86
within the .csproj
file. So I unloaded the project, edited it by changing all x86
to x64
, saved, reloaded, and was good to go after that.
I don't understand why I had to do this. The configuration manager was set to build as x64, but just wouldn't get set in the csproj
file :(
回答16:
After trying all the other suggestions posted here, I discovered the solution for me was to remove the following section from the .csproj
file:
<ItemGroup>
<Service Include="{808359B6-6B82-4DF5-91FF-3FCBEEBAD811}" />
</ItemGroup>
Apparently this service from the original project (unavailable on local machine) was halting the entire build process, even though it wasn't essential for compilation.