【问题标题】:How can I solve the "The OutputPath property is not set for this project" err?如何解决“未为此项目设置 OutputPath 属性”错误?
【发布时间】:2014-06-10 04:11:32
【问题描述】:

在我的 Windows CE 应用程序中,我一直在尝试将所有项目引用从“Any CPU”(或“AnyCPU”)更改为“x86”

为此,我手动编辑了 .csproj 文件(项目 > 属性...只有“任何 CPU”作为选项可用,没有“x86”(或其他任何东西)。

现在我不知道,但是,我得到了,“没有为此项目设置 OutputPath 属性。请检查以确保您指定了有效的配置/平台组合。Configuration='Debug '平台='AnyCPU'"

我无法想象问题出在哪里。 .csproj 文件中不再有任何“CPU”!

现在我注意到还有一个神秘的 .csdproj(扩展名中嵌入了额外的“d”)文件……但它也没有“CPU”,更不用说“AnyCPU”了……

进一步混淆的是 .csproj 文件似乎表明该项目需要许多 DLL,例如 Symbol*.DLL 文件 - 但这些在手持设备上不存在,而 .exe 在那里运行良好。怎么回事?

这是 .csproj 文件(省略了特别无聊的部分),然后是 .csdproj 文件:

<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectType>Local</ProjectType>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{CA63566E-76DE-4EE5-8292-71EBF90A9AC9}</ProjectGuid>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <ApplicationIcon>.\HHS.ico</ApplicationIcon>
    <AssemblyKeyContainerName>
    </AssemblyKeyContainerName>
    <AssemblyName>HHS</AssemblyName>
    <AssemblyOriginatorKeyFile>
    </AssemblyOriginatorKeyFile>
    <DelaySign>false</DelaySign>
    <OutputType>WinExe</OutputType>
    <OutputFileFolder>\Program Files\PDAClient</OutputFileFolder>
    <RootNamespace>PDAClient</RootNamespace>
    <StartupObject>PDAClient.MainApplication</StartupObject>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <OldToolsVersion>0.0</OldToolsVersion>
    <NativePlatformName>Windows CE</NativePlatformName>
    <FormFactorID>
    </FormFactorID>
  </PropertyGroup>
  <PropertyGroup>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <DeployDirSuffix>$(AssemblyName)</DeployDirSuffix>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\Debug\</OutputPath>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <BaseAddress>0</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>true</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <Optimize>false</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>4</WarningLevel>
    <DebugType>full</DebugType>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\Release\</OutputPath>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <BaseAddress>0</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>
    </DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>false</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <Optimize>true</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>4</WarningLevel>
    <DebugType>none</DebugType>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="HUtilCE, Version=1.5.0.1, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\HHS\HUtilCE.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.WindowsCE.Forms">
      <Name>Microsoft.WindowsCE.Forms</Name>
    </Reference>
    <Reference Include="mscorlib">
      <Name>MSCorLib</Name>
      <Private>False</Private>
    </Reference>
    <Reference Include="OpenNETCF, Version=1.3.50123.0, Culture=neutral">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\HHS\OpenNETCF.dll</HintPath>
    </Reference>
    <Reference Include="OpenNETCF.Windows.Forms, Version=1.3.50123.0, Culture=neutral">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\HHS\OpenNETCF.Windows.Forms.dll</HintPath>
    </Reference>
    <Reference Include="Symbol">
      <Name>Symbol</Name>
    </Reference>
    <Reference Include="Symbol.Barcode">
      <Name>Symbol.Barcode</Name>
    </Reference>
    <Reference Include="Symbol.BarcodeForms">
      <Name>Symbol.BarcodeForms</Name>
    </Reference>
    <Reference Include="Symbol.Printing">
      <Name>Symbol.Printing</Name>
    </Reference>
    <Reference Include="Symbol.StandardForms">
      <Name>Symbol.StandardForms</Name>
    </Reference>
    <Reference Include="System">
      <Name>System</Name>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Name>System.Data</Name>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data.SqlClient">
      <Name>System.Data.SqlClient</Name>
    </Reference>
    <Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=3be235df1c8d2ad3, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System.Drawing">
      <Name>System.Drawing</Name>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <Name>System.Windows.Forms</Name>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Name>System.XML</Name>
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AppSettings.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
. . .
    <Compile Include="WriteXML.cs">
      <SubType>Code</SubType>
    </Compile>
    <EmbeddedResource Include="frmAbout.resx">
      <DependentUpon>frmAbout.cs</DependentUpon>
    </EmbeddedResource>
. . .
    <EmbeddedResource Include="PrinterPickerForm.resx">
      <DependentUpon>PrinterPickerForm.cs</DependentUpon>
    </EmbeddedResource>
    <Content Include="HHS.ico">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="HHT.ICO">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
  <Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <PropertyGroup>
    <PreBuildEvent>
    </PreBuildEvent>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
</Project>

PDAClient.csdproj 中没有“AnyCPU”(或“x86”)...

更新

现在,当我卸载项目以进行编辑时,项目文件显示它“不可用”(.csproj 文件);也许它总是这么说,我只是注意到了,但无论如何,它不可用是“有趣的”;我可以从 Windows Explorer 访问/编辑它...

更新 2

关闭并重新打开项目导致它告诉我它是在早期版本的 Visual Studio 中创建的,需要升级..???...我让它继续,尤其是当它正在创建备份时复制到位,错误消失了...???

【问题讨论】:

    标签: compiler-errors compact-framework windows-ce csproj project-files


    【解决方案1】:

    这是您用有关您的项目的问题淹没 stackoverflow 的令人困惑的尝试之一。无需为 .NET 项目指定处理器架构。 DotNet 生成将由 DotNet 运行时翻译的 IL 代码。

    您不需要操作项目文件。

    【讨论】:

    • 我在其他地方看到过答案,说这正是导致其他人问题的原因——当他们需要的是“x86”时,他们选择了“任何 CPU”。更令人困惑的是,当您在手持设备上安装 CF 时,您必须在众多选择中进行选择,以选择部署哪一个(armv4、mipsii、mipsiv、sh4、x86)。
    • 根据我在设备上找到的文本文件(显然是自动生成的):“设备 CPU:'ARMV4I'”
    • DotNet 使用 IL。设备或主机的运行时间必须与处理器相匹配。类似于 JAVA 运行时:Java 应用程序使用 IL,Java 运行时必须与处理器和操作系统兼容,但 Java 应用程序仍然独立于处理器。
    • 那么你说的是手持设备上需要安装的那个cab是armv4文件夹里的那个吧?
    • 正确,您需要从正确的处理器目录安装 cab:ArmV4 或 ArmV4i 或其他。如果 cab 与设备的处理器不匹配,通常会被设备拒绝(取决于 cab 设置)。
    猜你喜欢
    • 2012-02-23
    • 2019-10-26
    • 2012-08-26
    • 2014-01-20
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 2018-04-29
    相关资源
    最近更新 更多