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

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

不过,现在我还不知道,“没有为此项目设置OutputPath属性。请检查以确保您指定了有效的Configuration/Platform组合。Configuration ='Debug'Platform ='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资源管理器中访问/编辑它。

更新2

关闭并重新打开该项目后,它告诉我它是在Visual Studio的早期版本中创建的,需要升级。........我继续进行,尤其是当它在原位创建备份副本时,错误消失了……?

最佳答案

这是使stackoverflow充满有关项目问题的令人困惑的尝试之一。无需为.NET项目指定处理器体系结构。 DotNet生成将由DotNet运行时转换的IL代码。

您不需要操纵项目文件。

10-01 17:54