Skip to content

Building in Visual Studio  #28

Closed
Closed

Description

@maryamariyan

From @terrajobst on Mar 26

On a clean machine, opening the solution file and building in VS fails as the Tools folder doesn't exist. Just running init-tools.cmd doesn't fix it either as it now fails with malformed AssemblyInfo.cs files.
I'm still trying to get build working from the command line (where I get mostly actionable error messages, like Install CMake) this feels like the sort of thing that discourages contributors quickly. Ideally, you should be able to clone the repo, open the solution in VS, and building immediately.
Thoughts?

Activity

  1. maryamariyan commented on May 4, 2018

    @maryamariyan
    ContributorAuthor

    From @eerhardt on Mar 26

    The error message you got told you to run build from the root of the repo first, right?
    This is the same experience as dotnet/corefx

  2. maryamariyan commented on May 4, 2018

    @maryamariyan
    ContributorAuthor

    From @terrajobst on Mar 26

    The error message you got told you to run build from the root of the repo first, right?

    Ah yes. Here is the error:

    The tools directory [P:\machinelearning\Tools/] does not exist. Please run build in the root of the repo to ensure the tools are installed before attempting to build an individual project.	
    

    I missed the "please run build in the root". So I take it back -- the error we provide is actually actionable, provided the person can read properly :-)

    This is the same experience as dotnet/corefx

    Yes, but in corefx it's mostly because for us there isn't necessarily a good way to build from the IDE. Other projects (like Roslyn and ASP.NET) allow for developing/building inside the IDE. I don't see why ML.NET has to be a CLI only build experience -- they sit on top of the platform.

  3. maryamariyan commented on May 4, 2018

    @maryamariyan
    ContributorAuthor

    From @eerhardt

    Other projects (like Roslyn and ASP.NET) allow for developing/building inside the IDE.

    These projects don't contain native code. And even harder, building native code cross platform.

    I don't see why ML.NET has to be a CLI only build experience

    It isn't a CLI only build experience. It is a "build from the CLI first" experience. After you build once from the command-line, you can then use the IDE until your heart is content.

  4. maryamariyan commented on May 4, 2018

    @maryamariyan
    ContributorAuthor

    From @terrajobst

    These projects don't contain native code. And even harder, building native code cross platform.

    That's fair.

    It isn't a CLI only build experience. It is a "build from the CLI first" experience.

    I see. I got the impression that you always have to run the build.cmd from the command line. For the initial prep, do I have to run build.cmd or should it be sufficient to just run init-tools.cmd? If not, maybe we should move init-tools.cmd out of the root.

  5. maryamariyan commented on May 5, 2018

    @maryamariyan
    ContributorAuthor

    @eerhardt can this issue be closed?

  6. danmoseley commented on May 7, 2018

    @danmoseley

    @maryamariyan once build.cmd has run from the root, is the VS experience on csproj and .vcxproj satisfactory? If so, yes. If not, please update the issue with the problem.

  7. eerhardt commented on May 8, 2018

    @eerhardt
    Member

    When you just open the .sln in Visual Studio and try to build with a clean repo, you get the error:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error		The tools directory [F:\git\machinelearning\Tools/] does not exist. Please run build in the root of the repo to ensure the tools are installed before attempting to build an individual project.	Microsoft.ML.Core	F:\git\machinelearning\Directory.Build.targets	4	
    

    Once you run build.cmd in the root of the repo, you are able to build and test in VS as expected.

    Closing.

  8. jstallm commented on May 24, 2018

    @jstallm

    In order to build in the Visual Studio IDE, need to call “build.cmd” from the command line first.

  9. DevLob-zz commented on Nov 22, 2018

    @DevLob-zz

    In order to build in the Visual Studio IDE, need to call “build.cmd” from the command line first.

    i do that but still can't build the solution

  10. eerhardt commented on Nov 22, 2018

    @eerhardt
    Member

    i do that but still can't build the solution

    What error are you getting?

  11. DevLob-zz commented on Nov 23, 2018

    @DevLob-zz

    i do that but still can't build the solution

    What error are you getting?

    image

  12. DevLob-zz commented on Nov 23, 2018

    @DevLob-zz
  13. DevLob-zz commented on Nov 23, 2018

    @DevLob-zz

    image

  14. eerhardt commented on Nov 23, 2018

    @eerhardt
    Member

    The last 2 errors about not supporting .NET Core 3.0 shouldn't block you from building. They can be ignored.

    The first screen shot you posted with 1000 errors - are you still getting those?

    What does the "Output" window say when you build?

  15. 4 remaining items

  16. Hiren161 commented on Feb 11, 2019

    @Hiren161

    when I run "build.cmd" then doing some process and then getting below error at the end.

    Error:
    The system cannot find the path specified.
    Commencing native build of dotnet/machinelearning

    Calling "D:\Git\ML\src\Native\gen-buildsys-win.bat" "D:\Git\ML\src\Native" "15 2017" x64
    CMake is a pre-requisite to build this repository but it was not found on the path. Please install CMake from https://www.cmake.org/download/ and ensure it is on your path.
    Failed to generate native component build project!
    D:\Git\ML\src\Native\build.proj(65,5): error MSB3073: The command ""D:\Git\ML\src\Native\build.cmd" Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native" exited with code 1.

    Build FAILED.

    D:\Git\ML\src\Native\build.proj(65,5): error MSB3073: The command ""D:\Git\ML\src\Native\build.cmd" Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native" exited with code 1.
    0 Warning(s)
    1 Error(s)

    Time Elapsed 00:09:22.47
    Command execution failed with exit code 1.

    Here is the msbuild.log file
    msbuild.log

    Try to build Solution but getting below 57 errors
    2019-02-11_1726

  17. eerhardt commented on Feb 11, 2019

    @eerhardt
    Member

    Please install CMake from https://www.cmake.org/download/ and ensure it is on your path.

    Did you do that?

    Check out https://github.com/dotnet/machinelearning/blob/master/docs/building/windows-instructions.md for all the prerequisites for building the repo.

  18. Hiren161 commented on Feb 13, 2019

    @Hiren161

    Please install CMake from https://www.cmake.org/download/ and ensure it is on your path.

    Did you do that?

    Check out https://github.com/dotnet/machinelearning/blob/master/docs/building/windows-instructions.md for all the prerequisites for building the repo.

    Yes we have tried it
    but it will not be able to build the application

    we are getting below error in Cmake:
    2019-02-11_1726
    2019-02-13_1819

  19. eerhardt commented on Feb 13, 2019

    @eerhardt
    Member

    @Hiren161 - can you try the following?

    1. Close all applications.
    2. From a command prompt in the root of your repo (looks to be D:/Git/ML:
      • > git clean -xdf
      • > .\build.cmd

    Does that succeed? If it fails, what errors does it print?

  20. Hiren161 commented on Feb 13, 2019

    @Hiren161

    Yes, I have tried this any getting below error:

    Build started 2/13/2019 9:58:24 PM.
    1>Project "D:\Git\ML\build.proj" on node 1 (default targets).
    1>CreateOrUpdateCurrentVersionFile:
    git describe --all HEAD 2>&1
    git rev-parse HEAD 2>&1
    GIT Branch Name as seen by git describe: 'heads/master'
    GIT Branch Name: 'master'
    git show -s --format=^%%cd --date=short HEAD
    RestoreProjects:
    Restoring all projects...
    1>Project "D:\Git\ML\build.proj" (1) is building "D:\Git\ML\Microsoft.ML.sln" (2) on node 1 (Restore target(s)).
    2>ValidateSolutionConfiguration:
    Building solution configuration "Debug|Any CPU".
    Restore:
    Restoring packages for D:\Git\ML\src\Microsoft.Data.DataView\Microsoft.Data.DataView.csproj...
    Restoring packages for D:\Git\ML\src\Microsoft.ML.Console\Microsoft.ML.Console.csproj...
    Restoring packages for
    62>BuildNativeWindows:
    D:\Git\ML\src\Native\build.cmd Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native
    "D:\Git\ML\src\Native\build.cmd" Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native
    **********************************************************************
    ** Visual Studio 2017 Developer Command Prompt v15.9.6
    ** Copyright (c) 2017 Microsoft Corporation
    **********************************************************************
    The system cannot find the path specified.
    Commencing native build of dotnet/machinelearning

         Calling "D:\Git\ML\src\Native\\gen-buildsys-win.bat" "D:\Git\ML\src\Native\" "15 2017" x64
         CMake is a pre-requisite to build this repository but it was not found on the path. Please install CMake from https://www.cmake.org/download/ and ensure it is on your path.
         Failed to generate native component build project!
     1>Done Building Project "D:\Git\ML\build.proj" (default targets) -- FAILED.
    62>D:\Git\ML\src\Native\build.proj(65,5): error MSB3073: The command ""D:\Git\ML\src\Native\build.cmd" Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native" exited with code 1.
    62>Done Building Project "D:\Git\ML\src\Native\build.proj" (Build target(s)) -- FAILED.
    

    Build FAILED.

       "D:\Git\ML\build.proj" (default target) (1) ->
       "D:\Git\ML\src\Native\build.proj" (Build target) (62) ->
       (BuildNativeWindows target) -> 
         D:\Git\ML\src\Native\build.proj(65,5): error MSB3073: The command ""D:\Git\ML\src\Native\build.cmd" Debug x64 --mkllibpath D:\Git\ML\packages/mlnetmkldeps\0.0.0.7\runtimes\win-x64\native" exited with code 1.
    0 Warning(s)
    1 Error(s)
    

    Time Elapsed 00:10:18.74

  21. eerhardt commented on Feb 13, 2019

    @eerhardt
    Member

    CMake is a pre-requisite to build this repository but it was not found on the path. Please install CMake from https://www.cmake.org/download/ and ensure it is on your path.

    Is cmake on your %PATH%? From that same command prompt can you tell me what cmake --version outputs?

  22. Hiren161 commented on Feb 14, 2019

    @Hiren161

    The issue is finally resolved now. Many thanks to @eerhardt
    Now, this is for reference for future readers who might come across this link.
    We are using Windows-10. Though we have downloaded CMake, but we have not set into an "Environment variable => %PATH%". After setting it, we were able to build the whole app.

    As a side note, during the build, if you get an error like -

    could not find any instance of visual studio.

    Then follow the below steps:
    1). Open Visual Studio
    2). Go to Tools -> Get Tools and Features
    3). In the "Workloads" tab enable "Desktop development with C++"
    4). Click Modify at the bottom right.

  23. KislayMohan commented on Apr 8, 2019

    @KislayMohan

    Hi,
    I tried above steps but still unable to build the solution. CMake is added in %Path% variable. Below are the steps I followed.
    -Closed all Visual Studio instance( using Visual Studio 2017 version 15.9.4)
    -CMake version: cmake version 3.13.4

    • Ran git clean-xdf.
    • Ran .\build.cmd from root folder (C:\My Data.net sample code\MachineLearning).
      Getting below error on build command

    Building native components...
    C:\My Data.net sample code\MachineLearning\src\Native\build.cmd Debug x64 --mkllibpath C:\My Data.net sample code\MachineLearning\packages/mlnetmkldeps\0.0.0.9\runtimes\win-x64\native


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



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


    [vcvarsall.bat] Environment initialized for: 'x86_x64'
    Commencing native build of dotnet/machinelearning

    Calling "C:\My Data.net sample code\MachineLearning\src\Native\gen-buildsys-win.bat" "C:\My Data.net sample code\MachineLearning\src\Native" "15 2017" x64
    -- The C compiler identification is MSVC 19.16.27025.1
    -- The CXX compiler identification is MSVC 19.16.27025.1
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found OpenMP_C: -openmp (found version "2.0")
    -- Found OpenMP_CXX: -openmp (found version "2.0")
    -- Found OpenMP: TRUE (found version "2.0")
    EXEC : CMake error : The following variables are used in this project, but they are set to NOTFOUND. [C:\My Data.net sample code\MachineLearning\src\Native\build.proj]
    -- Configuring incomplete, errors occurred!
    See also "C:/My Data/.net sample code/MachineLearning/bin/obj/x64.Debug/Native/CMakeFiles/CMakeOutput.log".
    Failed to generate native component build project!
    Please set them or make sure they are set and tested correctly in the CMake files:
    MKL_LIBRARY
    linked by target "SymSgdNative" in directory C:/My Data/.net sample code/MachineLearning/src/Native/SymSgdNative
    linked by target "MklProxyNative" in directory C:/My Data/.net sample code/MachineLearning/src/Native/MklProxyNative

    C:\My Data.net sample code\MachineLearning\src\Native\build.proj(67,5): error MSB3073: The command ""C:\My Data.net sample code\MachineLearning\src\Native\build.cmd" Debug x64 --mkllibpath C:\My Data.net sample code\MachineLearning\packages/mlnetmkldeps\0.0.0.9\runtimes\win-x64\native" exited with code 1.

    Build FAILED.

    EXEC : CMake error : The following variables are used in this project, but they are set to NOTFOUND. [C:\My Data.net sample code\MachineLearning\src\Native\build.proj]
    C:\My Data.net sample code\MachineLearning\src\Native\build.proj(67,5): error MSB3073: The command ""C:\My Data.net sample code\MachineLearning\src\Native\build.cmd" Debug x64 --mkllibpath C:\My Data.net sample code\MachineLearning\packages/mlnetmkldeps\0.0.0.9\runtimes\win-x64\native" exited with code 1.
    0 Warning(s)
    2 Error(s)

    Time Elapsed 00:02:50.82
    Command execution failed with exit code 1.

    After checking the folder I can see code in src\Native folder didn't build.
    Can anyone please help.

    Thanks,
    Kislay

  24. eerhardt commented on Apr 8, 2019

    @eerhardt
    Member

    Just a shot a in the dark - but can you try a folder without a space in it? We've had issues with having spaces in the repo path before:

    C:\My Data.net sample code\MachineLearning\

    try

    C:\MyDataSampleCode\MachineLearning\

  25. KislayMohan commented on Apr 9, 2019

    @KislayMohan

    Thanks Eric, the shot in the dark was right on spot.
    Is the space in repo path obstructing CMake?

  26. eerhardt commented on Apr 9, 2019

    @eerhardt
    Member

    Is the space in repo path obstructing CMake?

    Yeah, we probably have some build logic that isn't quoting the path correctly. CMake does support spaces in the path name, if you do it right.

    #2925 is an example of fixing such a build logic error.

  27. ghost locked as resolved and limited conversation to collaborators on Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions