At the moment I am building application in C#, in Visual Studio 2017. I need to change target build from "AnyPC" to "x86"(to be able to call some unmanaged dlls which are written in C). But when I am just changing target build in Configuration Manager(or in Properties)->switch to x86 platform/target; And after this I run the application,dotnet is crashing and error appears:"dotnet has stopped working".
I think I need somehow to use dotnet-x86 when compiling for x86 target, and to use dotnet(x64) when compiling for x64,somehow to add their paths but I have no idea how to do that. I hope you can help me guys
P.S:I am working on Windows 10 x64, VS-2017 Community, using .NET core 2.0
my program:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Need Help");
Console.ReadKey();
}
}
Output from Debug:'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[7276] dotnet.exe' has exited with code 255 (0xff).
Or with disabled "Just My Code":'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Cannot find or open the PDB file. The program '[1764] dotnet.exe' has exited with code 255 (0xff).
image of application
Thankfully I found the right answer for my problem: https://github.com/dotnet/cli/issues/7532
The .NET Core CLI team mentioned the fix is as follows:
Install both the x86 and x64 .NET Core 2.0 SDKs from https://www.microsoft.com/net/download/core. Put the following in a file named Directory.Build.targets that is somewhere above your project file (e.g. the root of the source repository). MSBuild will pick it up automatically for all projects:
<Project>
<PropertyGroup
Condition="'$(OS)' == 'Windows_NT' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(SelfContained)' != 'true'"
>
<RunCommand Condition="'$(PlatformTarget)' == 'x86'">$(MSBuildProgramFiles32)\dotnet\dotnet</RunCommand>
<RunCommand Condition="'$(PlatformTarget)' == 'x64'">$(ProgramW6432)\dotnet\dotnet</RunCommand>
</PropertyGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With