简体   繁体   English

编译C ++ / CLI DLL时发出警告

[英]Warning when compiling a C++/CLI DLL

I am developing a C++/CLI targeting .NET 4.0 that references my C# project with the Google Calendar API. 我正在开发一个针对.NET 4.0的C ++ / CLI,它使用Google Calendar API引用了我的C#项目。 The problem is, when I try to compile the C++ .DLL, it gives me the following warning: 问题是,当我尝试编译C ++ .DLL时,它给了我以下警告:

The primary reference "GoogleCalendar.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. 无法解析主引用“ GoogleCalendar.dll”,因为它间接依赖于框架程序集“ System.Net.Http,Version = 1.5.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”,无法在当前目标框架。 ".NETFramework,Version=v4.0". “ .NETFramework,版本= v4.0”。 To resolve this problem, either remove the reference "GoogleCalendar.dll" or retarget your application to a framework version which contains "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 若要解决此问题,请删除引用“ GoogleCalendar.dll”或将您的应用程序重新定位到包含“ System.Net.Http,Version = 1.5.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”的框架版本

I couldn't find any solutions to this problem, my app.config is already trying to redirect the System.Net.Http: 我找不到任何解决方案,我的app.config已经在尝试重定向System.Net.Http:

 <dependentAssembly>
     <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
 </dependentAssembly>

Any ideas? 有任何想法吗?

Edit: Another problem (don't know if related or not), when I compile my C++ project that references the C#: 编辑:另一个问题(不知道是否相关),当我编译引用C#的C ++项目时:

warning : Project must install nuget package Microsoft.Bcl, version=1.1.10. 警告:项目必须安装nuget软件包Microsoft.Bcl,版本= 1..1.10。 For more information, see http://go.microsoft.com/fwlink/?LinkID=317570 . 有关更多信息,请参见http://go.microsoft.com/fwlink/?LinkID=317570

But won't let me install because it's not native C#. 但是不要让我安装,因为它不是本机C#。

The google .net client library supports .net framework 4.5+ Google .net客户端库支持.net Framework 4.5+

在此处输入图片说明

While we try to support 4.0 not everything is going to work and I haven't tried it in quite sometime. 虽然我们尝试支持4.0,但并非所有功能都可以正常工作,而且我已经有一段时间没有尝试过了。 I recommend trying to go back to an older version of the library something around 1.12 I think should support 4.0 我建议尝试回到旧版本的库,大约1.12左右,我认为应该支持4.0

start here https://www.nuget.org/packages/Google.Apis.Calendar.v3/1.12.0.472 and work your way up see if you can find the version where it stops working. 从这里https://www.nuget.org/packages/Google.Apis.Calendar.v3/1.12.0.472开始,然后逐步向上看是否可以找到停止工作的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM