Net not found in System Namespace

Started by
13 comments, last by gan 15 years, 8 months ago
Here it is:

<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  <PropertyGroup>    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>    <ProductVersion>9.0.21022</ProductVersion>    <SchemaVersion>2.0</SchemaVersion>    <ProjectGuid>{017A53B5-8AB9-4C91-922D-60619739FCC0}</ProjectGuid>    <OutputType>Exe</OutputType>    <AppDesignerFolder>Properties</AppDesignerFolder>    <RootNamespace>Interweb</RootNamespace>    <AssemblyName>Interweb</AssemblyName>    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>    <FileAlignment>512</FileAlignment>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">    <DebugSymbols>true</DebugSymbols>    <DebugType>full</DebugType>    <Optimize>false</Optimize>    <OutputPath>bin\Debug\</OutputPath>    <DefineConstants>DEBUG;TRACE</DefineConstants>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">    <DebugType>pdbonly</DebugType>    <Optimize>true</Optimize>    <OutputPath>bin\Release\</OutputPath>    <DefineConstants>TRACE</DefineConstants>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>  </PropertyGroup>  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.        Other similar extension points exist, see Microsoft.Common.targets.  <Target Name="BeforeBuild">  </Target>  <Target Name="AfterBuild">  </Target>  -->  <ItemGroup>    <Compile Include="Internet.cs" />  </ItemGroup>  <ItemGroup>    <Reference Include="System.Net">      <RequiredTargetFramework>3.5</RequiredTargetFramework>    </Reference>  </ItemGroup></Project>
Advertisement
You're referencing the wrong assembly. HttpWebRequest etc are not defined in System.Net.dll, but in System.dll.

You can find this kind of information in the documentation:
HttpWebRequest

Quote:
HttpWebRequest Class
...
Provides an HTTP-specific implementation of the WebRequest class.
...
Namespace: System.Net
Assembly: System (in System.dll)
Andre Loker | Personal blog on .NET
VizOne is correct, i missed it.
just curious(You seems knows nothing about MSBuild.) how you create your C# project, normally you will have these from VS2008 IDE console apps generated:
<ItemGroup>    <Reference Include="System" />    <Reference Include="System.Core">      <RequiredTargetFramework>3.5</RequiredTargetFramework>    </Reference>    <Reference Include="System.Xml.Linq">      <RequiredTargetFramework>3.5</RequiredTargetFramework>    </Reference>    <Reference Include="System.Data.DataSetExtensions">      <RequiredTargetFramework>3.5</RequiredTargetFramework>    </Reference>    <Reference Include="System.Data" />    <Reference Include="System.Xml" />  </ItemGroup>  <ItemGroup>    <Compile Include="Program.cs" />    <Compile Include="Properties\AssemblyInfo.cs" />  </ItemGroup>


Quote:Original post by gan
VizOne is correct, i missed it.
just curious(You seems knows nothing about MSBuild.) how you create your C# project, normally you will have these from VS2008 IDE console apps generated:
*** Source Snippet Removed ***


Of course, you can also remove those references from the IDE, which is possibly what happened here.
Quote:Original post by jpetrie
Quote:Original post by gan
VizOne is correct, i missed it.
just curious(You seems knows nothing about MSBuild.) how you create your C# project, normally you will have these from VS2008 IDE console apps generated:
*** Source Snippet Removed ***


Of course, you can also remove those references from the IDE, which is possibly what happened here.



I know. Just curious what drove him to do so :)
Whos knows, maybe he was doing some tutorials on MSBuild :)

This topic is closed to new replies.

Advertisement