We've got a bunch of C# code that references Prism.Core. Prism.Core is a portable class library. When we reference this in C++/CLI and try to use a delegate command, we get:
C4691: 'System::Object': type referenced was expected in unreferenced assembly 'System.Runtime', type defined in current translation unit used instead
Can anyone explain why? And is there any way to fix, other than rebuilding the source, which I didn't want to do as Prism is Nugeted into our c# source?
I had a similar setup with the same warning. The C# project referenced a NuGet package with multiple target frameworks. Since managed NuGet packages cannot be added to C++/CLI projects, a reference had to be manually added for that project. The manually-added reference ended up being to a DLL for a different target framework in the NuGet package. Something like:
CSharpProject.csproj -> packages\Prism.Core.6.2.0\lib\portable-win+net45+wp80+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Prism.dll CppCliProject.vcxproj -> packages\Prism.Core.6.2.0\lib\net45\Prism.dll
Changing the reference in the C++/CLI project to use the same DLL as the C# project fixed it in my case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.