You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MSBuild version 15.3.255.36604 (Bundled with the VS 2017 15.3.0 Preview 2.0 [26605.1.d15rel]).
Fails to build the following project: https://github.com/NuGet/NuGet.Jobs
The same project builds fine with the MSBuild 15.1.1012.6693 (bundled with VS2017 15.2 (26430.12)).
"C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\bin\msbuild.exe" .\NuGet.Jobs.sln (msbuild paths may vary)
The first error produced:
Tests.Logger.Job.cs(9,7): error CS0246: The type or namespace name 'NuGet' could not be found (are you missing a using directive or an assembly reference?) [E:\dev\Nuget.Jobs\src\Tests.Logger\Tests.AzureJobTraceListener.csproj]
src\Tests.Logger\Tests.AzureJobTraceListener.csproj references the src\NuGet.Jobs.Common\NuGet.Jobs.Common.csproj which declares the NuGet namespace the compiler complains about, so there shouldn't be any error.
Further examination of the command line it uses to compile the Tests.AzureJobTraceListener.csproj indicates that NuGet.Jobs.Common.dll is not passed as a /reference to the csc.exe. I'm not sure how to dig deeper from this point.
msbuild.log.zip from the build produced with the /flp:v=diag command line argument.
The text was updated successfully, but these errors were encountered:
This appears to be happening because Microsoft.Bcl.Build.targets overrides the GetTargetPath target, which computes the TargetPathWithTargetPlatformMoniker item. #2039 changed the Build target to return that item, rather than the metadata-free $(TargetPath). This causes projects that use the targets from Microsoft.Bcl.Build to have no value returned from the Build target, so projects that reference them don't actually reference the produced assembly.
Workaround
Add this to the bottom of any project that refers to Microsoft.Bcl.Build, just before </Project>:
<!-- Work around https://github.com/Microsoft/msbuild/issues/2183 remove after VS 15.3 is released -->
<TargetName="Build"Condition=" '$(_InvalidConfigurationWarning)' != 'true' "DependsOnTargets="$(BuildDependsOn)"Returns="$(TargetPath)" />
rainersigwald
changed the title
MSBuild from the current VS2017 preview fails to build NuGet.Jobs project
Projects that override GetTargetPath have outputs ignored in referencing projects
Jun 7, 2017
Some projects (and some NuGet packages) override GetTargetPath, and they
can't be expected to keep up with changes in the metadata now returned
by it.
This change moves the computation of the item returned from GetTargetPath
and Build into its own target (recycling
GetTargetPathWithTargetPlatformMoniker), so that it will still be
created by a project that overwrites GetTargetPath.
Fixesdotnet#2183.
MSBuild version 15.3.255.36604 (Bundled with the VS 2017 15.3.0 Preview 2.0 [26605.1.d15rel]).
Fails to build the following project: https://github.com/NuGet/NuGet.Jobs
The same project builds fine with the MSBuild 15.1.1012.6693 (bundled with VS2017 15.2 (26430.12)).
Steps:
mkdir NuGet.Jobs
cd NuGet.Jobs
git clone https://github.com/NuGet/NuGet.Jobs.git .
git checkout dev
build.cmd
(tries to restore nuget packages, then build)nuget restore NuGet.Jobs.sln
(needsnuget.exe
present)"C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\bin\msbuild.exe" .\NuGet.Jobs.sln
(msbuild paths may vary)The first error produced:
src\Tests.Logger\Tests.AzureJobTraceListener.csproj
references thesrc\NuGet.Jobs.Common\NuGet.Jobs.Common.csproj
which declares theNuGet
namespace the compiler complains about, so there shouldn't be any error.Further examination of the command line it uses to compile the
Tests.AzureJobTraceListener.csproj
indicates thatNuGet.Jobs.Common.dll
is not passed as a/reference
to thecsc.exe
. I'm not sure how to dig deeper from this point.msbuild.log.zip from the build produced with the
/flp:v=diag
command line argument.The text was updated successfully, but these errors were encountered: