System.Net.Http.WebRequest works as a Microsoft.NETCore.App but not as a NETStandard.Library #17034
Labels
area-System.Net
packaging
Related to packaging
question
Answer questions and provide assistance, not an issue with source code or documentation.
Milestone
The following code snippet and project.json combo restore, build and run:
program.cs
...
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
project.json
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002394"
}
},
"frameworks": {
"netcoreapp1.0": {}
}
}
Using the same code and creating a library does not
http.tar.gz
build (note the original library code did not have an entry point, but this was just for simplicity).
project.json
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library" : "1.5.0-rc2-23931"
},
"frameworks": {
"netstandard1.5": {}
}
}
/Users/xyz/Documents/Projects/bug/http/Program.cs(17,9): error CS0246: The type or namespace name 'HttpWebRequest' could not be found (are you missing a using directive or an assembly reference?)
/Users/xyz/Documents/Projects/bug/http/Program.cs(17,50): error CS0103: The name 'WebRequest' does not exist in the current context
/Users/xyz/Documents/Projects/bug/http/Program.cs(17,35): error CS0246: The type or namespace name 'HttpWebRequest' could not be found (are you missing a using directive or an assembly reference?)
/Users/xyz/Documents/Projects/bug/http/Program.cs(21,20): error CS0246: The type or namespace name 'HttpWebResponse' could not be found (are you missing a using directive or an assembly reference?)
/Users/xyz/Documents/Projects/bug/http/Program.cs(21,48): error CS0246: The type or namespace name 'HttpWebResponse' could not be found (are you missing a using directive or an assembly reference?)
dotnet --info
.NET Command Line Tools (1.0.0-rc2-002394)
Product Information:
Version: 1.0.0-rc2-002394
Commit Sha: 3a423b1080
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
The text was updated successfully, but these errors were encountered: