I have ran into an issue while using a VC++ project reference in my aspnetcore Webapplication solution(.net Framework).Let me explain the issue.
1.Created a new aspnetcore webapplication.
2.Added a VC++ project (CLR-->ClassLibrary)
3.Added a C# Class Library project and aded VC++ project reference in the References of C#ClassLibrary.
4.Call the method in C#Classlibrary in the Main Project which in turn return a value from VC++ ClassLibrary
The solution builds with out any error ,but at run time I Get the error-"Additional information: Could not load file or assembly 'CppClassLibrary, Version=1.0.6164.19946, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made
to load a program with an incorrect format."
PS. I have set my build Platform as AnyCPU for the main Project and C#LibraryProject, and for VC++ Class library it is Win32 which are all by default.
My machine is Windows 7 64 bit.
Someone please let me know how this scenario can be worked out.I We cannot get rid of VC++ references as it would be high impact change in our application suite.
None
0 Points
3 Posts
Asp.Net Core Web Application(.NET Framework)
Nov 16, 2016 10:22 PM|jamesjosephpt|LINK
Hello Everyone,
I have ran into an issue while using a VC++ project reference in my aspnetcore Webapplication solution(.net Framework).Let me explain the issue.
1.Created a new aspnetcore webapplication.
2.Added a VC++ project (CLR-->ClassLibrary)
3.Added a C# Class Library project and aded VC++ project reference in the References of C#ClassLibrary.
4.Call the method in C#Classlibrary in the Main Project which in turn return a value from VC++ ClassLibrary
The solution builds with out any error ,but at run time I Get the error-"Additional information: Could not load file or assembly 'CppClassLibrary, Version=1.0.6164.19946, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
PS. I have set my build Platform as AnyCPU for the main Project and C#LibraryProject, and for VC++ Class library it is Win32 which are all by default.
My machine is Windows 7 64 bit.
Someone please let me know how this scenario can be worked out.I We cannot get rid of VC++ references as it would be high impact change in our application suite.
A quick help is much appreciated.
Thanks In Advance,
James
All-Star
17652 Points
3510 Posts
Re: Asp.Net Core Web Application(.NET Framework)
Nov 18, 2016 07:36 AM|Chris Zhao|LINK
Hi James,
You're having a 32-bit / 64-bit conflict.
On a 64-bit Windows operating system:
You could ger more information about the Prefer 32-bit and Any CPU from the following documents:
What is the purpose of the “Prefer 32-bit” setting in Visual Studio 2012 and how does it actually work?
What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11
https://msdn.microsoft.com/en-us/library/zekwfyz4.aspx
Best Regards,
Chris