msbuild cannot build new style csproj when targetting net462
See original GitHub issueFrom @SidShetye on June 19, 2018 23:48
Steps to reproduce
Problem demo’d at the repo at https://github.com/SidShetye/msbuild-newcsproj-issue
Expected behavior
build the project like VS2017 gui does on the same machine
Actual behavior
build fails even though there are no nuget dependencies
Build FAILED.
"C:\temp\new-old-proj-mix-soln\ClassLibraryFw462NewProj\ClassLibraryFw462NewProj.csproj" (build target) (1) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error :
Assets file 'C:\temp\new-old-proj-mix-soln\ClassLibraryFw462NewProj\obj\project.assets.json' not found. Run a NuGet package restore
to generate this file. [C:\temp\new-old-proj-mix-soln\ClassLibraryFw462NewProj\ClassLibraryFw462NewProj.csproj]
0 Warning(s)
1 Error(s)
Environment data
msbuild /version
output:
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
15.7.179.6572
OS info: Win 10 x64 v1803 (OS Build 17134.112) VS 2017 (15.7.4)
Copied from original issue: Microsoft/msbuild#3429
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Build errors with version conflicts (.net 4.6.2 and . ...
Building the solution locally with the latest visual studio update is working, only in combination ... xxx\xxx.csproj' targets 'net462'.
Read more >MSBuild reference for .NET SDK projects
Reference for the MSBuild properties and items that are understood by ... For more information, see Target frameworks in SDK-style projects.
Read more >Build succeeded with projects Ctrl + Shift + B that MSBuild ...
MSB4078: The project file 'MyProject.csproj' is not supported by MSBuild and cannot be built? My project is running with Target Framework .Net ...
Read more >Upgrading an existing .NET project files to the lean new ...
They are effectively MSBuild files that orchestrate the build process. Phrased differently, a csproj file is an instance of an MSBuild file.
Read more >Multi-targetting .Net Framework and .Net Core in a single project
The new csproj file is a fraction of the complexity of the old-style projects, and it handles both NetFramework and NetCore very simply....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the detailed report!
All projects that use
Microsoft.NET.Sdk
require NuGet restore before build. You can accomplish this with a small change to your build script:The VS build does NuGet restore independently and silently, which is why it works transparently.
what are the way to resolve below Issues while Build is going on from VSTS ?? even after ran dotnet build, dotnet restore not able to fix . ??
C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): Error : Assets file ‘D:\a\3\s\obj\project.assets.json’ not found. Run a NuGet package restore to generate this file.
Process ‘msbuild.exe’ exited with code ‘1’.