使用System.ServiceModel的.NET Framework 2.0中的项目不能在Windows 7计算机上编译,而是在Windows Server 2008 R2计算机上编译。你能解释为什么吗?在Windows 7和Windows Server 2008 R2上使用.NET 2.0的System.ServiceModel
项目文件Test1.vbproj:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<OutputPath>bin\Debug</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="IService1.vb" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
</Project>
的IService1.vb:
Imports System.ServiceModel
<ServiceContract()> Public Interface IService1
<OperationContract()> Function Function1() As String
End Interface
在Windows 7 32位机这个项目不能编译,显示错误消息:
类型'OperationContract'未定义。
类型'ServiceContract'未定义。
在Windows Server 2008 R2 64位计算机上,此项目成功编译。
项目开盘的Windows 7计算机上:
该项目在Windows服务器上打开2008 R2机器:
的.NET框架安装在Windows 7机器:
个安装了Windows Server 2008 R2的计算机上的.NET框架:
在Windows 7计算机上的Windows功能:
Windows功能在Windows Server 2008 R2机器:
Windows 7的机器性能:
在Windows Server 2008 R2机器性能:
是否有人有一个想法,为什么它不会对Windows 7的编译机器,但编译在Windows Server 2008 R2机器上?
我必须在Windows 7机器上编译它,而不必更改代码或项目文件。因此,我必须在Windows 7机器上安装或配置一些东西。
是否在可选功能下安装了.net 3.5 sp1? – magicandre1981
是的,在两台机器上都安装了.NET 3.5。我在问题中添加了相关的Windows功能屏幕截图。 – Alex