-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msbuild cannot build new style csproj when targetting net462 #2347
Comments
Thanks for the detailed report! All projects that use diff --git a/DemoProblem.ps1 b/DemoProblem.ps1
index ae1b278..fbcee89 100644
--- a/DemoProblem.ps1
+++ b/DemoProblem.ps1
@@ -37,7 +37,7 @@ gci . -Recurse -Include bin,obj | % { ri -Recurse -Force $_.FullName }
# And now it barfs :/
# building in VS2017 (15.7.4) works just fine though
$cwd=$PSScriptRoot # just point to current directory / soln dir
-msbuild .\ClassLibraryFw462NewProj\ClassLibraryFw462NewProj.csproj /p:SolutionDir=$cwd /p:Configuration=Debug /m /t:build
+msbuild .\ClassLibraryFw462NewProj\ClassLibraryFw462NewProj.csproj /p:SolutionDir=$cwd /p:Configuration=Debug /m /t:build /restore
# dump our msbuild version too
msbuild /version
\ No newline at end of file The VS build does NuGet restore independently and silently, which is why it works transparently. |
Moving to the sdk repo to see if there's interest in optimizing for the no- |
I think it is OK that restore is required. Even if your project doesn't have any PackageReferences, you could have project references to projects that have PackageReferences, which means restore would be necessary for your build. So determining that you don't need restore would require walking the project references, at which point you might as well be restoring anyway. |
Agreed. This seems like too small of a case to warrant adding this complexity to the system. Going to close the issue for now. If there are strong arguments to doing this, please, make your case. |
A simple
to handle the nuget restore phase. Why does nuget restore need to be done only with the EDIT: Our actual CI failure had real nuget references but during simplification to post here it was observed that having no actual nuget reference still caused this failure. |
Let's just reopen it until we've tracked this down. @rrelyea Is |
@davkean speaking of repro, I've updated https://github.com/SidShetye/msbuild-newcsproj-issue to reproduce this issue even after issuing the equivalent of |
@SidShetye I tried running your repro script at https://github.com/SidShetye/msbuild-newcsproj-issue/commit/76af77794933aee8f073d5781b7364d57ce3e595; it restores and builds without error on my machine. |
I actually downloaded the latest nuget.exe and checked it in to minimize variability over nuget.exe. Still, it's the same version you have and the same from nuget.org
here is what I see
git repo state
|
Aha!
MSBuild 14 didn't support PackageReferences, so this is probably the proximate cause of the problem. It sounds like @SidShetye I think this might work around the autodetection: nuget.exe restore -MSBuildPath $(Split-Path -Path (get-command msbuild.exe).source -Parent) .\new-old-proj-mix-soln.sln |
what are the way to resolve below Issues while Build is going on from VSTS ?? 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'. |
@Amit-Kumar-Sonkar That looks like a separate issue. Can you reproduce it in isolation?
|
@Amit-Kumar-Sonkar I’m experiencing a similar issue on Azure DevOps. |
I could finally fix the issue on the server. The error that I was getting in Azure DevOps Pipelines build:
I'm using packages stored stored in an Azure DevOps Artifacts feed. Solution: I pinned the specific version 2.1.500 of the .net Core SDK using the command I hope that this helps preventing issues from the final version for the SDK 2.2. /cc @rainersigwald |
This happens with TFS 2015 vNext builds as well when using the MSBuild task (using a custom location pointing to msbuild v15). To fix it, I had to split the one MSBuild task into two, and add a powershell task in between them.
I think this is a problem with that TFS 2015 msbuild task and nuget. When enabling that package restore option on the msbuild task, the logs show that nuget is using msbuild v14.0 and that is probably what doesnt understand the An excerpt to show what I mean with the versions.
|
I am having same issues on AzureDevOps pipeline after updating my projects to .net core 2.2. |
Added instruction on how to list templates in case template with given name doesn't exist.
Added instruction on how to list templates in case template with given name doesn't exist.
From @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
Environment data
msbuild /version
output:OS info: Win 10 x64 v1803 (OS Build 17134.112)
VS 2017 (15.7.4)
Copied from original issue: dotnet/msbuild#3429
The text was updated successfully, but these errors were encountered: