无法构建面向Framework 2.0的项目 [英] Can't build a project that target Framework 2.0

查看:128
本文介绍了无法构建面向Framework 2.0的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用CLR创建一个C ++ DLL项目,目标是.Net 3.5。


我使用该工具并为目标.net 3.5创建了一个用于CLR的空项目C ++


我编译了项目,但DLL引用了mscorlib 2.0和4.0,这使得链接到.Net3.5项目无效。


我应该配置项目在VS2017中构建一个> Net 3.5吗?






项目文件确实显示目标版本为V35。


  < PropertyGroup Label =" Globals">

  &NBSP; < VCProjectVersion> 15.0< / VCProjectVersion>

  &NBSP; < ProjectGuid> {910AEA7C-FDA7-4CF0-8020-783F6AD5D5F5}< / ProjectGuid>

  &NBSP; < TargetFrameworkVersion> v3.5< / TargetFrameworkVersion>

  &NBSP; <关键字> ManagedCProj< / Keyword>

  &NBSP; < RootNamespace> TestCLR< / RootNamespace>

  &NBSP; < WindowsTargetPlatformVersion> 10.0.17763.0< / WindowsTargetPlatformVersion>

  < / PropertyGroup>


Yigal Spinner




解决方案

嗨yspinner,


欢迎来到MSDN论坛。


你可以改变Visual C ++项目设置,以定位不同版本的.NET Framework并使用不同的平台工具集。  默认情况下,
,项目系统使用.NET Framework版本和与您用于创建项目的Visual Studio版本对应的工具集版本。您可以通过修改项目属性来更改目标平台工具集。
您可以通过修改项目(.vcxproj)文件来更改目标框架。
您不必为每个编译目标维护单独的代码库。  


请查看此文档:
https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and- platform-toolset?view = vs-2017  。


希望它会有所帮助等待反馈。


最好的问候,


五月&NBSP;


I want to create a C++ DLL project with CLR that targets .Net 3.5.

I used the tool and created an empty project C++ for CLR with target .net 3.5

I compiled the project, but the DLL references mscorlib 2.0 and 4.0 which makes it invalid to link with a .Net3.5 project.

How should I configure the project to build a >Net 3.5 in VS2017?


The project file does show that target version is V35.

  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{910AEA7C-FDA7-4CF0-8020-783F6AD5D5F5}</ProjectGuid>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <Keyword>ManagedCProj</Keyword>
    <RootNamespace>TestCLR</RootNamespace>
    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
  </PropertyGroup>

Yigal Spinner


解决方案

Hi yspinner,

Welcome to the MSDN forum.

You can change Visual C++ project settings to target different versions of the .NET Framework and to use different platform toolsets. By default, the project system uses the .NET Framework version and the toolset version that correspond to the version of Visual Studio that you use to create the project. You can change the target platform toolset by modifying the project properties. You can change the target Framework by modifying the project (.vcxproj) file. You do not have to maintain a separate code base for every compilation target. 

Please have a look with this Docs: https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=vs-2017 .

Hope it would be helpful and waiting a feedback.

Best Regards,

May 


这篇关于无法构建面向Framework 2.0的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆