I can't seem to find anyone with this same issue and it had me pulling out my hair for hours. I am working on a .net core project with a team of people. I realize my version was quite a bit out of date and upgraded to version 1.0.4. However, since the update, I can no longer build or run the project without errors.
C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependancyResolution.targets(154,5): error : Assets file 'C:\Users\ZL\Documents\lynx\lynx%20project\src\Lynx.Web\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Users\ZL\Documents\lynx\lynx%20project\src\Lynx.Web\Lynx.Web.csproj] obj\Debug\netcoreapp1.1\Lynx.Web.AssembleyInfo.cs(6,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a directive or an assembly reference?)
[C:\Users\ZL\Documents\lynx\lynx%20project\src\Lynx.Web\Lynx.Web.csproj]
These files exist and look fine. I have run a dotnet restore
and dotnet clean
. I tried wiping out the obj and bin folders and regenerating them. I wiped our NuGet cache. I tried uninstalling .NET Core and reinstalling it. I even blew away my code completely and pulled a fresh version from git. The other team members can build the code fine and it works on other machines just not my windows 10 machine. It seems like a dotnet restore should fix it, and everywhere I found when researching similar problems that was the fix. Some sort of version of something is out of wack but I can't figure it out. Is there something I need to update that I'm missing?
**EDITED to add csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Lynx.Web</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Lynx.Web</PackageId>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<Compile Remove="node_modules\**\*" />
<None Update="ClientApp\dist\**\*;Views\**\*;wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="wwwroot\dist\*.map">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="1.1.0-*" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.0.2" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="1.0.0" />
<PackageReference Include="IdentityServer4" Version="1.2.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
</Target>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
Thanks in advance.
Note: The . NET 5.0 SDK versions will continue to be supported in VS 16.11 until December of 2022 when . NET Core 3.1 goes out of support so that . NET Core 3.1 customers can continue to use 16.11 to developer their applications.
Starting with the December 2022 servicing update for Visual Studio 2019 16.11, Visual Studio 2019 17.0, and Visual Studio 2022 17.2, the . NET Core 3.1 component in Visual Studio will be changed to out of support and optional.
NET Framework 4.8. To determine the installed . NET version, use the following Release DWORD: 528449 (Windows 11 and Windows Server 2022)
If you have a preview installed of the requested . NET SDK version, you also need to set the option to enable previews in Visual Studio. Go to Tools > Options > Environment > Preview Features, and make sure that Use previews of the . NET Core SDK is checked.
I was able to finally figure it out. On my machine, the project was in the folder lynx project
, however, somehow when I pulled code or updated my version that folder name changed to lynx%20project
. Thats why it was unable to find any files. I jumped in and changed the directory name and it was fixed. Thank you all who tried to help. Hopefully this will save some poor dev some time in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With