Lunar
❔ Multiple MSBuild Version
I have one solution containing multiple projects
What I want is on server I want X version of MSBuild
And on local it will run on Y version of MSbuild
what I think is by updating Visual Studio it updates MSBUild version ?
I am literally have no clue how to achieve this?
Same solution with muliple version on differnet environment,Even is it possible ?
I am getting bunch of errrors -
1 MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "Microsoft.Build.Tas
ks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Could not load file or assembly 'Microsoft.Build.Tasks.v12.0, Version=12
.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2 error MSB4062: The "TransformXml" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Micr osoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utili ties.Core,
And bunch of errors....
2 replies
❔ HttpClient Error
I have class HttpClientObject that create object of HttpClient
public class HttpClientObject{
private readonly HttpClient client;
public HttpClientObject(CustomParameters parameter)
{
handler=new HttpClientHandler(){}
client = new HttpClient(handler) { Timeout=parameter.timeout };
}
public HttpClient GetClient()
{
return client;
}
}
I have another class to fetch data
public class student{
HttpClientObject httpClientObject {get;set;}
HttpClient client = httpClientObject .GetClient();
//For X condition true it will timeout period 1 else by default
if(x)
{
client .Timeout = TimeSpan.FromSeconds(1);
}
var result = client .GetAsync("url").GetAwaiter().GetResult();
}
But I am getting error - "This instance has already started one or more requests. Properties can only be modified".
Getting error because of changing the Timeout and throws InvalidOperationException .
Is there any safe solution ?
107 replies
❔ HttpWebRequest
Here in below code what does stream.Write do ?
Does it add header to web request?
or Does it console log to server?
I`m not familiar with stream
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(TestUrl);
var data = Encoding.ASCII.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/json";
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
45 replies