Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8899705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:55:22+00:00 2026-06-15T00:55:22+00:00

I have a c# project and in the solution, the platform target is AnyCPU.

  • 0

I have a c# project and in the solution, the platform target is AnyCPU. While I have a build program that will daily build this solution and it uses msbuild.exe. The command likes:

MSBuild D:\my.sln /p:Configuration=Release /p:Platform=x86 /t:rebuild ….

Here I specify the compiled platform should be x86.

I my opinion, the msbuild.exe should overwrite solution configure and the output should be x86 exe instead of anyCPU type.

I try these codes into this project:

        PortableExecutableKinds peKind;
        ImageFileMachine machine;

        Assembly.GetExecutingAssembly().ManifestModule.GetPEKind(out peKind, out machine);

The test result suggest, the exe is AnyCPU mode (ILOnly), not what expected.
In such condition, how can i know my program it compiler by x86 or x64, by code?

Thanks.
Li

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:55:23+00:00Added an answer on June 15, 2026 at 12:55 am

    I prefer not to build the .sln file but use use a little build script with msbuild.exe

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
    
    <Target Name="BuildProjects" >
    
        <ItemGroup>      
            <BuildProjectsInputFiles Include="**\MainProject\*.??proj" />
            <BuildProjectsInputFiles Include="**\AnotherProject\*.??proj" />
        </ItemGroup>
    
        <MSBuild Projects="@(BuildProjectsInputFiles)" Properties="Configuration=$(Configuration);OutputPath=$(MSBuildProjectDirectory)\Deploy\bin\%(BuildProjectsInputFiles.FileName)">
            <Output TaskParameter="TargetOutputs"
                    ItemName="BuildProjectsOutputFiles" />
        </MSBuild>
    
    </Target>
    
    </Project>
    

    Now I use msbuild with this call

    msbuild.exe build.xml /p:OutputPath=bin\Debug;Configuration=Release;Platform=x86 /target:BuildProjects
    

    And that works

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a solution that is being referenced by a MSBuild project. In the
I have installation solution that have installer project (not web installer but simple installer)
I have in my solution around 17 project, that has ANY CPU (x86 +
I have a solution where the executable's target platform was initially set to x86
Suppose my solution have two project: myApp: silverlight application project: the default application App
I have a database solution project in VS2008 - it generates SQL for more
I have a legacy project in my solution without comments and many warnings. I
Need to add two same name .csproj class libraries in my solution.Have two project
In a .net application involving several projects in one solution, I have a project
I have a multi-project ASP.NET + C# solution. I was planning on writing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.