I am currently unable to compile my Blazor application using .NET Core 3 Preview and Visual Studio 2019 Preview (Latest Version, just downloaded)
I have only created a few files.
MainLayoutModel.cs (In Shared Folder)
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ICSSNetwork
{
public class MainLayoutModel : LayoutComponentBase
{
[Inject] protected AppState AppState { get; set; }
protected async Task Logout()
{
await AppState.Logout();
}
}
}
LoginDetails.cs (Project Root)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ICSSNetwork
{
public class LoginDetails
{
public string Username { get; set; }
public string Password { get; set; }
}
}
AppState.cs (Project Root)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Helpers;
namespace ICSSNetwork
{
public class AppState
{
private readonly HttpClient _httpClient;
// private readonly ILocalStorage _localStorage;
public bool IsLoggedIn { get; private set; }
public AppState(HttpClient httpClient)
// ILocalStorage localStorage)
{
_httpClient = httpClient;
//_localStorage = localStorage;
}
public async Task Login(LoginDetails loginDetails)
{
//var response = await _httpClient.PostAsync(Urls.Login, new StringContent(Json.Serialize(loginDetails), Encoding.UTF8, "application/json"));
if (loginDetails.Password == "TEST123")
{
//await SetAuthorizationHeader();
IsLoggedIn = true;
}
}
public async Task Logout()
{
//await _localStorage.RemoveItem("authToken");
IsLoggedIn = false;
}
//private async Task SaveToken(HttpResponseMessage response)
//{
// var responseContent = await response.Content.ReadAsStringAsync();
// var jwt = Json.Deserialize<JwToken>(responseContent);
// await _localStorage.SetItem("authToken", jwt.Token);
//}
//private async Task SetAuthorizationHeader()
//{
// if (!_httpClient.DefaultRequestHeaders.Contains("Authorization"))
// {
// var token = await _localStorage.GetItem<string>("authToken");
// _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// }
//}
}
}
I built my project when I first created it and it built fine. After adding these files I am getting the following build error:
Error MSB3073 The command "dotnet "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.mono\3.0.0-preview8.19380.1\build\netstandard1.0\../../tools/illink/illink.dll" -l none --disable-opt unreachablebodies --verbose --strip-security true --exclude-feature com --exclude-feature sre -v false -c link -u link -b true -d "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.mono\3.0.0-preview8.19380.1\build\netstandard1.0\../../tools/mono/bcl/" -d "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.mono\3.0.0-preview8.19380.1\build\netstandard1.0\../../tools/mono/bcl/Facades/" -o "C:\Users\adamc\Desktop\ICSSNetworkManager\ICSSNetwork\ICSSNetwork\obj\Debug\netstandard2.0\blazor\linker/" -x "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview8.19405.7\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Users\adamc\Desktop\ICSSNetworkManager\ICSSNetwork\ICSSNetwork\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\adamc\.nuget\packages\blazored.localstorage\2.0.12\lib\netstandard2.0\Blazored.LocalStorage.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnet.razor\3.2.7\lib\net45\System.Web.Razor.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnet.webpages\3.2.7\lib\net45\System.Web.Helpers.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnet.webpages\3.2.7\lib\net45\System.Web.WebPages.Deployment.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnet.webpages\3.2.7\lib\net45\System.Web.WebPages.Razor.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnet.webpages\3.2.7\lib\net45\System.Web.WebPages.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.authorization\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.httpclient\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.HttpClient.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.components\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Components.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.components.web\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Components.Web.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.metadata\3.0.0-preview8.19405.7\lib\netstandard2.0\Microsoft.AspNetCore.Metadata.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.bcl.asyncinterfaces\1.0.0-preview8.19405.3\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.extensions.dependencyinjection\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.extensions.logging.abstractions\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.extensions.options\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.Extensions.Options.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.extensions.primitives\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.jsinterop\3.0.0-preview8.19405.4\lib\netstandard2.0\Microsoft.JSInterop.dll" -a "C:\Users\adamc\.nuget\packages\microsoft.web.infrastructure\1.0.0\lib\net40\Microsoft.Web.Infrastructure.dll" -a "C:\Users\adamc\.nuget\packages\mono.webassembly.interop\3.0.0-preview8.19405.4\lib\netstandard2.0\Mono.WebAssembly.Interop.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.buffers\4.5.0\lib\netstandard2.0\System.Buffers.dll" -a "C:\Users\adamc\.nuget\packages\system.componentmodel.annotations\4.6.0-preview8.19405.3\lib\netstandard2.0\System.ComponentModel.Annotations.dll" -a "C:\Users\adamc\.nuget\packages\system.memory\4.5.3\lib\netstandard2.0\System.Memory.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.numerics.vectors\4.5.0\lib\netstandard2.0\System.Numerics.Vectors.dll" -a "C:\Users\adamc\.nuget\packages\system.runtime.compilerservices.unsafe\4.6.0-preview8.19405.3\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll" -a "C:\Users\adamc\.nuget\packages\system.text.encodings.web\4.6.0-preview8.19405.3\lib\netstandard2.0\System.Text.Encodings.Web.dll" -a "C:\Users\adamc\.nuget\packages\system.text.json\4.6.0-preview8.19405.3\lib\netstandard2.0\System.Text.Json.dll" -a "C:\Users\adamc\.nuget\packages\system.threading.tasks.extensions\4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll" -a "C:\Users\adamc\Desktop\ICSSNetworkManager\ICSSNetwork\ICSSNetwork\obj\Debug\netstandard2.0\ICSSNetwork.dll"" exited with code -532462766. ICSSNetwork C:\Users\adamc\.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview8.19405.7\targets\Blazor.MonoRuntime.targets 441
Anyone have any idea as to what may be causing this? Is it a bug with the .NET Core 3 Preview?
Unhandled Exception: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Web, Version=4.0.0.0, Culture=neutral
Seems it can't resolve System.Web but I don't see why. – Adam Creed