Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net C++/使用NET 4.5的CLI静态库项目正在引用NET 4.0 System.dll_.net_Visual Studio 2013_C++ Cli_.net 4.5 - Fatal编程技术网

.net C++/使用NET 4.5的CLI静态库项目正在引用NET 4.0 System.dll

.net C++/使用NET 4.5的CLI静态库项目正在引用NET 4.0 System.dll,.net,visual-studio-2013,c++-cli,.net-4.5,.net,Visual Studio 2013,C++ Cli,.net 4.5,我在一个更大的解决方案中创建了一个C++/CLI项目,作为一个静态库 我在Properties/C/C++中添加了$(FrameworkPathOverride):“附加的#使用目录” 我手动将v4.5添加到项目文件中,并为平台工具集设置了“VisualStudio2013(v120)” 因此,该项目现在看起来不错,并且在“引用”选项卡中显示了NET4.5 然后我转到References选项卡添加System.dll。该列表仅显示4.0框架程序集,当我选择System时,它会将System.dl

我在一个更大的解决方案中创建了一个C++/CLI项目,作为一个静态库

我在Properties/C/C++中添加了$(FrameworkPathOverride):“附加的#使用目录”

我手动将
v4.5
添加到项目文件中,并为平台工具集设置了“VisualStudio2013(v120)

因此,该项目现在看起来不错,并且在“引用”选项卡中显示了NET4.5

然后我转到References选项卡添加System.dll。该列表仅显示4.0框架程序集,当我选择System时,它会将System.dll文件添加到项目中。 但是,添加的System.dll文件来自本地GAC_MSIL\System\v4.0_4.0.0.0_uxxx文件夹,该文件夹包含NET 4.0程序集,我无法对其进行任何更改

我希望看到的是“C:\Program Files(x86)\Reference Assembly\Microsoft\Framework.NETFramework\v4.5”路径,而不是4.0 GAC

这实际上造成了一个问题,因为我现在在解决方案中添加了对另一个从4.5 Framework位置引用System.dll的项目(这次是C#类库)的引用,然后发生了System.dll冲突,导致以下错误:

warning C4945: 'Regex' : cannot import symbol from 'c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.5\system.dll': as 'System::Text::RegularExpressions::Regex' has already been imported from another assembly 'System'
2>          c:\windows\microsoft.net\assembly\gac_msil\system\v4.0_4.0.0.0__b77a5c561934e089\system.dll : see declaration of 'System::Text::RegularExpressions::Regex'
有没有办法从4.5 Framework位置生成NET 4.5 C++/CLI静态库项目参考System.dll


谢谢

我在其他地方读到过,所以4.5取代4.0的可能性很小。4.5程序集将驻留在您提到的目录中。包含各种版本的4.x程序集的目录位于\program files目录结构的某个位置。如果你在上面找到了另一篇文章,那么它就会有它所在的目录。我还读到,在运行时了解差异的唯一真实方法是使用4.5中不存在的功能,很难猜测您是如何将路径弄得如此混乱的。版本很好。起点已经错误,无法创建静态库项目。它生成一个.lib文件,并且仅在链接该文件时可用。链接器不支持该操作。您必须使用VisualC++ ++ CLR>类库项目模板。@ HANSPASANT,我花了好几天的时间来解决为什么我不能使用.NET 4.5,我用了一个新的“空项目”来支持CLR。现在我发现了.NET 4.5.2。我使用VisualC++ ++ CLR>“空CLR项目”模板。谢谢,你保存了我剩下的头发!!