.net msbuild compiler-warnings microsoft-fakes

.net - MSB3270: Desajuste entre la arquitectura del procesador-Fakes Framework



msbuild compiler-warnings (4)

¿Usaste bibliotecas de terceros? Si los usa, verifíquelos para ver si usan el mismo x86 que el procesador de destino. Está claro que el procesador objetivo debe ser el mismo para todas las referencias, no solo para el objetivo de su proyecto.

ACTUALIZACIÓN: Al parecer, este tipo de Microsoft también está experimentando esto. Puedes intentar usar su solución:

http://blogs.msdn.com/b/astebner/archive/2012/05/03/10300809.aspx

Desde la entrada del blog, haga esto: busque este " PlatformTarget " en su archivo csproj y edítelo para que coincida con esto:

<PlatformTarget Condition=" ''$(PlatformTarget)'' == '''' ">x86</PlatformTarget>

Déjame saber si esto resuelve tu problema.

ACTUALIZACIÓN 2: Según su código fuente de unittest.csproj y classlib.csproj, la configuración aún se basa en "AnyCPU".

Por favor, busque esta línea:

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

Y también esta línea:

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

Aquellas plataformas de destino también deben configurarse para usar x86.

La forma más sencilla es configurar Debug y Release haciendo clic en "Configuration Manager ..." en el cuadro combinado "Debug" en la barra de herramientas de Visual Studio, como en esta ilustración general:

Desde que uso Fakes Framework en mi prueba de unidad, recibo la siguiente advertencia de MSBuild.

advertencia MSB3270: hubo una discrepancia entre la arquitectura del procesador del proyecto que se está construyendo "MSIL" y la arquitectura del procesador de la referencia "DocumentServiceModel", "x86". Este desajuste puede causar fallos en el tiempo de ejecución. Considere cambiar la arquitectura de procesador objetivo de su proyecto a través del Administrador de configuración para alinear las arquitecturas de procesador entre su proyecto y las referencias, o tome una dependencia de las referencias con una arquitectura de procesador que coincida con la arquitectura de procesador objetivo de su proyecto. [C: / Projekte / XXX / XXX / XXX / Source / Testing / UT / XXX.Unit Test / obj / Debug / Fakes / ppsm / f.csproj]

El objetivo de la plataforma de todos los proyectos en la solución se establece en x86.

¿Cómo puedo deshacerme de esta advertencia de construcción?

ACTUALIZACIÓN1:

Creo que el problema es que Fakes Framework crea un proyecto dinámico con un objetivo de plataforma "Cualquier CPU".

(C: / Projekte / XXX / XXX / XXX / Source / Testing / UT / XXX.UnitTest / obj / Debug / Fakes / ppsm / f.csproj)

Este proyecto dinámico hace referencia a los ensamblados de mi proyecto, que se ejecuta con un objetivo de plataforma "x86".

No tengo idea de cómo cambiar el proyecto dinámico de Fake a "x86".

ACTUALIZACIÓN2:

Creé un proyecto de muestra y recibo la misma advertencia:

Warning 1 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "MSBErrorTest", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:/Projekte/MSBErrorTest/UnitTestProject1/obj/Debug/Fakes/msbet/f.csproj] UnitTestProject1

UnitTest csproj:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" ''$(Configuration)'' == '''' ">Debug</Configuration> <Platform Condition=" ''$(Platform)'' == '''' ">AnyCPU</Platform> <ProjectGuid>{4B14EC56-DDC7-4A16-92BA-2D2881E695D1}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>UnitTestProject1</RootNamespace> <AssemblyName>UnitTestProject1</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <VisualStudioVersion Condition="''$(VisualStudioVersion)'' == ''''">10.0</VisualStudioVersion> <VSToolsPath Condition="''$(VSToolsPath)'' == ''''">$(MSBuildExtensionsPath32)/Microsoft/VisualStudio/v$(VisualStudioVersion)</VSToolsPath> <ReferencePath>$(ProgramFiles)/Common Files/microsoft shared/VSTT/$(VisualStudioVersion)/UITestExtensionPackages</ReferencePath> <IsCodedUITest>False</IsCodedUITest> <TestProjectType>UnitTest</TestProjectType> </PropertyGroup> <PropertyGroup Condition=" ''$(Configuration)|$(Platform)'' == ''Debug|AnyCPU'' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin/Debug/</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" ''$(Configuration)|$(Platform)'' == ''Release|AnyCPU'' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin/Release/</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="MSBErrorTest.Fakes"> <HintPath>FakesAssemblies/MSBErrorTest.Fakes.dll</HintPath> </Reference> <Reference Include="System" /> </ItemGroup> <Choose> <When Condition="(''$(VisualStudioVersion)'' == ''10.0'' or ''$(VisualStudioVersion)'' == '''') and ''$(TargetFrameworkVersion)'' == ''v3.5''"> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> </ItemGroup> </When> <Otherwise> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" /> </ItemGroup> </Otherwise> </Choose> <ItemGroup> <Compile Include="UnitTest1.cs" /> <Compile Include="Properties/AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../MSBErrorTest/MSBErrorTest.csproj"> <Project>{f1ae6c89-6f6a-404e-b9e2-10ee2f66942f}</Project> <Name>MSBErrorTest</Name> </ProjectReference> </ItemGroup> <ItemGroup> <Fakes Include="Fakes/MSBErrorTest.fakes" /> </ItemGroup> <Choose> <When Condition="''$(VisualStudioVersion)'' == ''10.0'' And ''$(IsCodedUITest)'' == ''True''"> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> </ItemGroup> </When> </Choose> <Import Project="$(VSToolsPath)/TeamTest/Microsoft.TestTools.targets" Condition="Exists(''$(VSToolsPath)/TeamTest/Microsoft.TestTools.targets'')" /> <Import Project="$(MSBuildToolsPath)/Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ClassLib csproj:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)/$(MSBuildToolsVersion)/Microsoft.Common.props" Condition="Exists(''$(MSBuildExtensionsPath)/$(MSBuildToolsVersion)/Microsoft.Common.props'')" /> <PropertyGroup> <Configuration Condition=" ''$(Configuration)'' == '''' ">Debug</Configuration> <Platform Condition=" ''$(Platform)'' == '''' ">AnyCPU</Platform> <ProjectGuid>{F1AE6C89-6F6A-404E-B9E2-10EE2F66942F}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MSBErrorTest</RootNamespace> <AssemblyName>MSBErrorTest</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" ''$(Configuration)|$(Platform)'' == ''Debug|AnyCPU'' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin/Debug/</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" ''$(Configuration)|$(Platform)'' == ''Release|AnyCPU'' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin/Release/</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Class1.cs" /> <Compile Include="Properties/AssemblyInfo.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)/Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ACTUALIZACIÓN3:

Cambié mi configuración para tener este aspecto.

<PropertyGroup Condition="''$(Configuration)|$(Platform)'' == ''Debug|x86''"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin/x86/Debug/</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup>

Pero sigo recibiendo la advertencia


En el archivo .csproj de project_name, elimine el nodo ItemGroup donde se establece el atributo processorArchitecture. Algo como

<ItemGroup> <Reference ... , processorArchitecture=MSIL"> ... </ItemGroup>

Eso me ayudó.



Ya que estoy recibiendo este error solo para los ensamblajes falsos en los que solo ejecutaré pruebas unitarias, decidí ignorar este error. Esto se puede lograr agregando esto a su XML falso:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/"> <Assembly Name="FakedAssemblyName.dll"/> <Compilation> <Property Name="ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch">None</Property> </Compilation> </Fakes>