问题描述
在调试/重新编译C#项目时收到此错误消息:
未为项目“ Example.csproj”设置OutputPath属性。 请检查以确保您指定了有效的组合 该项目的配置和平台。配置='调试' 平台='x86'。如果某些其他项目是也可能会出现此错误 试图遵循该项目的项目间参考 项目已卸载或未包含在解决方案中,并且 引用项目未使用相同或等效项进行构建 配置或平台。
我不知道项目配置中可能出什么问题了
<?xml version="1.0" encoding="utf-8"?>
<Project Toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<ProjectType>local</ProjectType>
<ProjectVersion>7.10.377</ProjectVersion>
<OutputPath>bin\x86\</OutputPath>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E34FF2B3-527D-4006-B312-3D88C491ADBC}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<AssemblyName>Example</AssemblyName>
<OutputType>WinExe</OutputType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
有人有主意吗?预先感谢!
解决方法
您可以尝试三种方法:
-
请删除项目根目录中的bin和obj文件夹,然后重新生成程序。
-
请在
OutputPath
之前放置<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
。如下:<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <PropertyGroup> ...... </PropertyGroup> <PropertyGroup> ...... </PropertyGroup> <PropertyGroup> ... </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> ...... </ItemGroup> </Project>
-
请检查是否引用了已卸载的项目。删除有问题的参考文献可以解决此问题。