question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default platform target in Properties window is incorrect

See original GitHub issue

From @davidmatson on August 28, 2017 19:40

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>
</Project>
using System;
using System.Reflection;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(Environment.Is64BitProcess);
        ImageFileMachine b;
        typeof(Program).Assembly.ManifestModule.GetPEKind(out PortableExecutableKinds a, out b);
        Console.WriteLine($"{a}: {b}");
    }
}

Actual output:

True
ILOnly: I386

But, properties window shows: image

Copied from original issue: dotnet/project-system#2744

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:29 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
davkeancommented, Sep 5, 2017

From @tannergooding on August 28, 2017 21:1

You can workaround the issue for the time being by explicitly specifying <PlatformTarget>AnyCPU</PlatformTarget> in your project file.

1reaction
am11commented, Sep 14, 2017

@davkean, based on last comment, I was able to make the platform target set to x64 by explicitly setting all platform-like properties for net462 xunit project:

  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>

    <!-- ideally we should only specify PlatformTarget like old csproj -->
    <!-- upstream issue: https://github.com/dotnet/sdk/issues/1560 -->
    <Platform>x64</Platform>
    <Platforms>$(Platform)</Platforms>
    <PlatformName>$(Platform)</PlatformName>
    <PlatformTarget>$(Platform)</PlatformTarget>
  </PropertyGroup>

then in SLN, added x64 configurations like this:

Global
  GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {GUID}.Debug|x64.ActiveCfg = Debug|x64
    {GUID}.Debug|x64.Build.0 = Debug|x64
    {GUID}.Release|x64.ActiveCfg = Release|x64
    {GUID}.Release|x64.Build.0 = Release|x64
  EndGlobalSection
EndGlobal

After that, property page shows only one option:

Platform: Active (x64)

(which was the desired behavior)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't change target platform to "any CPU"
In the SolutionProperties -> ConfigurationManager for this second project, the "Any CPU" platform is not available and I can't add a new one, ......
Read more >
MSBuild error MSB8037
In the Property Pages dialog, select Configuration Properties > General. Modify the Windows SDK Version or Target Platform Version.
Read more >
XAF0006: Invalid target platform. Change the ...
Right-click the project in the Solution Explorer and select “Properties”. Navigate to the Build tab and set the Platform target property to “Any...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >
Angular workspace configuration
Build targetlink. The architect/build section configures defaults for options of the ng build command. It has the following top-level properties.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found