Coder Social home page Coder Social logo

Comments (8)

samuelchen avatar samuelchen commented on May 29, 2024 2

@janpio thanks. I solved it by using environment variable MSBUILDDIR

from cordova-windows.

janpio avatar janpio commented on May 29, 2024 1

cordova-windows uses multiple methods to try to figure out a matching MSBuild version - it's quite a mess and very brittle code, so I am not too surprised it is not working all the time. (But with a default 2017 install - an probably without .NET MSBuild installed - it should definitely work)

If it can only find the 4.0, your easiest solution is probably to use the MSBUILDDIR or VSINSTALLDIR environment variables mentioned in the blog post here: https://cordova.apache.org/announcements/2018/02/27/cordova-windows-6.0.0.html Set them and try again, this should override the internal logic.

from cordova-windows.

sandeep-dutta-0893 avatar sandeep-dutta-0893 commented on May 29, 2024 1

@janpio
I had similar issue where the build for windows just failed to detect MSBuild.
VS2017 and cordova-windows 6.0.0 did the trick.
Thanks a bunch.

from cordova-windows.

shazron avatar shazron commented on May 29, 2024

See http://www.visualstudioextensibility.com/2016/11/23/some-implications-of-the-new-modular-setup-of-visual-studio-2017-for-vsx-developers/ :

The location of MSBuild for VS 2017 has changed, and can be several of them.
In the past (until Visual Studio 2015), the path of MSBuild was “C:\Program Files (x86)\MSBuild\<version>”, where <version> was “4.0”, “12.0” (VS 2013), “14.0” (VS 2015). 

There is no “15.0” folder there for VS 2017. Instead, MSBuild for VS 2017 is installed in the folder “C:\Program Files (x86)\Microsoft Visual Studio\2017\<edition>\MSBuild\15.0”, where edition can be “Community”, “Professional” or “Enterprise”. 

Again, for your own use on your own build script you can hardcode the path, but if you want to use a more proper way, you need to get the VS 2017 installation folder as explained above and concatenate “MSBuild\15.0”. 

Or you can wait until Microsoft releases a document about how to resolve MSBuild location (they are working on it and now that MSBuild is open source you can follow the progress on GitHub). BTW, you can download the MSBuild Tools for Visual Studio 2017 RC here.

So, to have auto-detect working properly we need to add more locations to check as per the article, and only rely on the registry as a fallback. I had VS 2017 Community installed, and it only detected MSBuild v4 from the .NET Framework so I had to use the MSBUILDDIR env var.

from cordova-windows.

sayore avatar sayore commented on May 29, 2024

So is there a definitive solution for this?

from cordova-windows.

samuelchen avatar samuelchen commented on May 29, 2024

I am facing a similar issue (I installed universal windows platform build tools15.8.7 on window 10):

MSBuild v4.0 is not supported, aborting.
No valid MSBuild was detected for the selected target: AppPackages folder doesn't exist

C:\work\hello-cordova>cordova requirements

Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: not installed
MSBuild tools v.14.0 not found. Please install Visual Studio 2015 Community or higher from https://www.visualstudio.com/downloads/download-visual-studio-vs
Visual Studio: installed 15.8
Windows SDK: installed 10.0
Windows Phone SDK: installed 10.0
Some of requirements check failed

C:\work\hello-cordova>cordova build windows --verbose
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform windows
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in windows platform
No differences found between plugins added to project and installed in windows platform. Continuing...
Generating platform-specific config.xml from defaults for windows at C:\work\hello-cordova\platforms\windows\config.xml
Merging project's config.xml into platform-specific windows config.xml
Merging and updating files from [www, platforms\windows\platform_www] to platforms\windows\www
  copy  platforms\windows\platform_www\cordova-js-src\confighelper.js platforms\windows\www\cordova-js-src\confighelper.js (updated file)
  copy  platforms\windows\platform_www\cordova-js-src\exec.js platforms\windows\www\cordova-js-src\exec.js (updated file)
  copy  platforms\windows\platform_www\cordova-js-src\platform.js platforms\windows\www\cordova-js-src\platform.js (updated file)
  copy  platforms\windows\platform_www\cordova_plugins.js platforms\windows\www\cordova_plugins.js (updated file)
  copy  www\css\index.css platforms\windows\www\css\index.css (updated file)
  copy  www\index.html platforms\windows\www\index.html (updated file)
  copy  www\js\index.js platforms\windows\www\js\index.js (updated file)
This app does not have any icons or splash screens defined
Prepared windows project successfully
No scripts found for hook "pre_package".
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
getLatestMatchingMSBuild
getLatestMSBuild
Searching for available MSBuild versions...
Running command: C:\windows\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5 /v MSBuildToolsPath
Running command: C:\windows\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0 /v MSBuildToolsPath
Running command: C:\windows\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath
Running command: C:\windows\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath
Running command: C:\windows\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 /v MSBuildToolsPath
Command finished with error code 1: C:\windows\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\windows\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\windows\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\windows\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5,/v,MSBuildToolsPath
Command finished with error code 0: C:\windows\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0,/v,MSBuildToolsPath
Found MSBuild v4.0 at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Using MSBuild v4.0 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
MSBuild v4.0 is not supported, aborting.
No valid MSBuild was detected for the selected target: AppPackages folder doesn't exist
CordovaError: No valid MSBuild was detected for the selected target: AppPackages folder doesn't exist
    at C:\work\hello-cordova\platforms\windows\cordova\lib\build.js:83:29
    at _rejected (C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:864:24)
    at C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:890:30
    at Promise.when (C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:808:41)
    at C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:624:44
    at runSingle (C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:137:13)
    at flush (C:\work\hello-cordova\platforms\windows\cordova\node_modules\q\q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

from cordova-windows.

janpio avatar janpio commented on May 29, 2024

@edenprojectde No.
@samuelchen Open a new issue and include all available environment information of your system.

from cordova-windows.

janpio avatar janpio commented on May 29, 2024

MSBUILDDIR and VSINSTALLDIR are indeed the solution here if VS17 can not detect MSBuild for any reason. apache/cordova-docs#976 will add this to the documentation.

from cordova-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.