Skip to content
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

Build with VS 2017 only doesn't work #7859

Closed
felipepessoto opened this issue Apr 11, 2017 · 26 comments · Fixed by dotnet/coreclr#11182
Closed

Build with VS 2017 only doesn't work #7859

felipepessoto opened this issue Apr 11, 2017 · 26 comments · Fixed by dotnet/coreclr#11182

Comments

@felipepessoto
Copy link
Contributor

I followed the instructions mentioned here: https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for Visual Studio 2017.

I don't have VS 2015.

When calling build from Developer Command Prompt for VS 2017 I receive this error:

Running: C:\Users\myuser\Source\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\myuser\Source\coreclr\Tools\run.exe C:\Users\myuser\Source\coreclr\config.json build -Project=C:\Users\myuser\Source\coreclr\build.proj -generateHeaderWindows -NativeVersionHeaderFile="C:\Users\myuser\Source\coreclr\bin\obj\_version.h" -BuildOS=Windows_NT -BuildType=Debug -BuildArch=x64
Running: C:\Users\myuser\Source\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log  C:\Users\myuser\Source\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT  /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\myuser\Source\coreclr\bin\obj\_version.h
MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'Tools\/net46\/Microsoft.DotNet.Build.Tasks.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Switch: BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log
Command execution failed with exit code 1.
BUILD: Restoring the OptimizationData Package
Tools are already initialized.
Running: C:\Users\myuser\Source\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\myuser\Source\coreclr\Tools\run.exe C:\Users\myuser\Source\coreclr\config.json sync -optdata
Running: C:\Users\myuser\Source\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /flp:v=detailed;LogFile=sync.log /t:RestoreOptData /p:RestoreDuringBuild=true  ./build.proj
MSBUILD : error MSB1009: Project file does not exist.
Switch: ./build.proj
Command execution failed with exit code 1.
BUILD: Error: Failed to restore the optimization data package.
@danmoseley
Copy link
Member

Can you try "clean -all" from the root, then try again?

@Pothulapati
Copy link
Contributor

@danmosemsft Iam getting the exact same error when I try to Build. I also tried clean -all before doing build but I get the same error .

@danmoseley
Copy link
Member

does this file exist? \Tools/net46/Microsoft.DotNet.Build.Tasks.dll

@felipepessoto
Copy link
Contributor Author

I am without computer access. It happened even after a Windows clean installation (Creators update).

@Pothulapati
Copy link
Contributor

@danmosemsft Yes,The File exists but I get the same error

@Pothulapati
Copy link
Contributor

@danmosemsft I also tried building the repo on an Azure VM but It's showing the same error.I think this issue needs some attention.

@jnm2
Copy link
Contributor

jnm2 commented Apr 19, 2017

I'm having this issue also on a brand new clone. From VS2017 developer command prompt:

C:\Users\jmusser\Source\Repos\coreclr>build
Starting Build at 21:36:58.97
BUILD: Commencing CoreCLR Repo build
BUILD: Checking prerequisites
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\VsDevCmd.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26403.7
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Installing dotnet cli...
Restoring BuildTools version 1.0.27-prerelease-01413-01...
Initializing BuildTools ...
Updating CLI NuGet Frameworks map...
Done initializing tools.
Running: C:\Users\jmusser\Source\Repos\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\jmusser\Source\Repos\coreclr\Tools\run.exe C:\Users\jmusser\Source\Repos\coreclr\config.json build -Project=C:\Users\jmusser\Source\Repos\coreclr\build.proj -generateHeaderWindows -NativeVersionHeaderFile="C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h" -BuildOS=Windows_NT -BuildType=Debug -BuildArch=x64
Running: C:\Users\jmusser\Source\Repos\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log  C:\Users\jmusser\Source\Repos\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT  /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h
MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'Tools\/net46\/Microsoft.DotNet.Build.Tasks.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Switch: BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log
Command execution failed with exit code 1.

Whereas with the VS2015 developer command prompt I get:

C:\Users\jmusser\Source\Repos\coreclr>build
Starting Build at 21:42:58.26
BUILD: Commencing CoreCLR Repo build
BUILD: Checking prerequisites
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\VsDevCmd.bat"
Tools are already initialized.
Running: C:\Users\jmusser\Source\Repos\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\jmusser\Source\Repos\coreclr\Tools\run.exe C:\Users\jmusser\Source\Repos\coreclr\config.json build -Project=C:\Users\jmusser\Source\Repos\coreclr\build.proj -generateHeaderWindows -NativeVersionHeaderFile="C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h" -BuildOS=Windows_NT -BuildType=Debug -BuildArch=x64
Running: C:\Users\jmusser\Source\Repos\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log  C:\Users\jmusser\Source\Repos\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT  /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h
Command execution succeeded.

https://github.com/dotnet/coreclr/issues/10181 looks related.

@felipepessoto felipepessoto changed the title Build wit 2017 don't work Build with VS 2017 don't work Apr 19, 2017
@felipepessoto
Copy link
Contributor Author

felipepessoto commented Apr 19, 2017

Here is the log from the brand new Windows install and pre requisites:

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26403.7
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************

C:\Users\felip\Source>cd C:\Users\felip\Source\coreclr

C:\Users\felip\Source\coreclr>build skiptests
Starting Build at 23:24:09.54
BUILD: Commencing CoreCLR Repo build
BUILD: Checking prerequisites
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\VsDevCmd.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26403.7
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Installing dotnet cli...
Restoring BuildTools version 1.0.27-prerelease-01413-01...
Initializing BuildTools ...
Updating CLI NuGet Frameworks map...
Done initializing tools.
Running: C:\Users\felip\Source\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\felip\Source\coreclr\Tools\run.exe C:\Users\felip\Source\coreclr\config.json build -Project=C:\Users\felip\Source\coreclr\build.proj -generateHeaderWindows -NativeVersionHeaderFile="C:\Users\felip\Source\coreclr\bin\obj\_version.h" -BuildOS=Windows_NT -BuildType=Debug -BuildArch=x64
Running: C:\Users\felip\Source\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log  C:\Users\felip\Source\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT  /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\felip\Source\coreclr\bin\obj\_version.h
MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'Tools\/net46\/Microsoft.DotNet.Build.Tasks.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Switch: BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log
Command execution failed with exit code 1.
BUILD: Restoring the OptimizationData Package
Tools are already initialized.
Running: C:\Users\felip\Source\coreclr\Tools\dotnetcli\dotnet.exe C:\Users\felip\Source\coreclr\Tools\run.exe C:\Users\felip\Source\coreclr\config.json sync -optdata
Running: C:\Users\felip\Source\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /flp:v=detailed;LogFile=sync.log /t:RestoreOptData /p:RestoreDuringBuild=true  ./build.proj
MSBUILD : error MSB1009: Project file does not exist.
Switch: ./build.proj
Command execution failed with exit code 1.
BUILD: Error: Failed to restore the optimization data package.

@felipepessoto felipepessoto changed the title Build with VS 2017 don't work Build with VS 2017 doesn't work Apr 20, 2017
@ahsonkhan
Copy link
Contributor

@gkhanna79, should we prioritize this issue?

@gkhanna79
Copy link
Member

@tannergooding Can you PTAL?

@tannergooding
Copy link
Member

In both cases, the only difference I see in the output given and the output I produce is that my build is additionally passing in: /p:RestoreDefaultOptimizationDataPackage=false /p:UsePartialNGENOptimization=false

However, the error logs they have both have the following path: Tools\/net46\/Microsoft.DotNet.Build.Tasks.dll. I would expect that the combination of slashes (\/) as the directory separators is having some negative impact here....

My Output:

Starting Build at  8:38:10.25
BUILD: Commencing CoreCLR Repo build
BUILD: Checking prerequisites
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\VsDevCmd.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26403.7
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Installing dotnet cli...
Restoring BuildTools version 1.0.27-prerelease-01413-01...
Initializing BuildTools ...
Updating CLI NuGet Frameworks map...
Done initializing tools.
Running: D:\Workspaces\coreclr\Tools\dotnetcli\dotnet.exe D:\Workspaces\coreclr\Tools\run.exe D:\Workspaces\coreclr\config.json build -Project=D:\Workspaces\coreclr\build.proj -generateHeaderWindows -NativeVersionHeaderFile="D:\Workspaces\coreclr\bin\obj\_version.h" -BuildOS=Windows_NT -BuildType=Debug -BuildArch=x64
Running: D:\Workspaces\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log  D:\Workspaces\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT  /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=D:\Workspaces\coreclr\bin\obj\_version.h /p:RestoreDefaultOptimizationDataPackage=false /p:UsePartialNGENOptimization=false

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.48
Command execution succeeded.
BUILD: Restoring the OptimizationData Package
Tools are already initialized.
Running: D:\Workspaces\coreclr\Tools\dotnetcli\dotnet.exe D:\Workspaces\coreclr\Tools\run.exe D:\Workspaces\coreclr\config.json sync -optdata
Running: D:\Workspaces\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false  /flp:v=detailed;LogFile=sync.log /t:RestoreOptData /p:RestoreDuringBuild=true  ./build.proj

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.09
Command execution succeeded.
BUILD: Commencing build of native components for Windows_NT.x64.Debug
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
...

@felipepessoto
Copy link
Contributor Author

@tannergooding have you installed VS2015 in that computer?

@jnm2
Copy link
Contributor

jnm2 commented Apr 23, 2017

I have the exact same problem running the build from the VS2017 prompt on a brand new Windows install without VS2015 that I did on a machine with VS2015.

@tannergooding
Copy link
Member

@fujiy, I valided on machines with the following configurations:

  • VS2012 + VS2013 + VS2015 + VS2017
  • VS2013 + VS2015 + VS2017
  • VS2015 + VS2017
  • VS2017

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2017

@tannergooding This is frustrating. I'm loathe to install VS2015 on my new builds of Windows, so I have to remote to the machine that has it in order to build coreclr. What can we do to facilitate a fix to allow building from the VS2017 prompt?

@felipepessoto felipepessoto changed the title Build with VS 2017 doesn't work Build with VS 2017 only doesn't work Apr 24, 2017
@gkhanna79
Copy link
Member

@tannergooding Didn't you confirm that repo built clean from within VS 2017 prompt?

@tannergooding
Copy link
Member

@jnm2, that's the thing. I can successfully build on VS2017 standalone (Community, Professional, or Enterprise) without any issues (both from clean machines and from existing machines with other VS instances). So I am unsure what is blocking your machine from doing the same.

The only difference I've seen in the logs is that your path is somehow resolving to have \/ instead of just / ( you have Tools\/net46\/Microsoft.DotNet.Build.Tasks.dll, while I end up with Tools/net46/Microsoft.DotNet.Build.Tasks.dll).

This is the command that is failing for you:
C:\Users\jmusser\Source\Repos\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log C:\Users\jmusser\Source\Repos\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h

and given the failure, my best guess would be to just "correct" the path for the /l:BinClashLogger arg and see if that resolves the issue (so run C:\Users\jmusser\Source\Repos\coreclr\Tools\msbuild.cmd /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false /l:BinClashLogger,Tools\net46\Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log C:\Users\jmusser\Source\Repos\coreclr\build.proj /p:__BuildType=Debug /p:__BuildArch=x64 /p:__BuildOS=Windows_NT /t:GenerateVersionHeader /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=C:\Users\jmusser\Source\Repos\coreclr\bin\obj\_version.h

Outside of that, I don't think I'll be able to get much further without diagnostic MSBuild logs.

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2017

@tannergooding Running the failing command gives the original error. Running the command you corrected gives:

MSBUILD : error MSB1021: Cannot create an instance of the logger. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Switch: BinClashLogger,Tools\net46\Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log

Guess I'll post a diagnostic log next.

@tannergooding
Copy link
Member

tannergooding commented Apr 24, 2017

@jnm2, are you running commands from the repository root (looks like C:\Users\jmusser\Source\Repos\coreclr in your case)?

I'm actually wondering if this is a similar issue to dotnet/corefx#18700, commands would fail if the repository root was not your working directory.

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2017

@tannergooding I have been, but for that command I cd'd to \Tools. I'll try from the root.

Ah, the corrected command succeeded from the root.

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2017

@tannergooding Both commands succeed when the working directory is the repo root. However, I have never run /build.cmd itself except from the repo root. dotnet/corefx#18700 looks likely.

@tannergooding
Copy link
Member

Awesome.

@gkhanna79, It looks like there are two parts to a fix here:

  1. CoreCLR needs a fix similar to Fix building with only VS2017 installed. corefx#18700 so that users can build from any working directory
  2. Whatever parses the config.json should probably attempt to fully resolve the path and do so with regards to the repository root (this would result in full paths being passed in everywhere)

@felipepessoto
Copy link
Contributor Author

felipepessoto commented Apr 24, 2017

Now I can build CoreFX.

I'm not sure why, since I always built from the repository directory. Is VS Developer CMD forcing a different working directory?

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2017

@fujiy I think because dotnet/corefx#18700 was merged four days ago?

@felipepessoto
Copy link
Contributor Author

Yes, as @tannergooding said, we need a similar fix for CoreClr.

What doesn't make sense yet is that I was building from repository directory, It seems that VS 2017 Developer CMD is changing the working directory

@felipepessoto
Copy link
Contributor Author

felipepessoto commented Apr 24, 2017

I'm doing some tests and I will try to send a fix

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@tannergooding tannergooding removed their assignment May 26, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants