Repository: conan-io/conan-center-index

Issue:
[package] yasm/1.3.0: can't build on windows
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **yasm/1.3.0:**
  * Operating System+version: **windows 10**
  * Compiler+version: **MSVC 2019**
  * Conan version: **1.44.1**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
cppstd=17
os=Windows
os_build=Windows
[options]
pictofitstudio*:with_sentry=True
[build_requires]
[env]
CONAN_USE_ALWAYS_SHORT_PATHS=True
```


### Steps to reproduce (Include if Applicable)
conan install yasm/1.3.0@ --build "*"


### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
cppstd=17
os=Windows
os_build=Windows
[options]
pictofitstudio*:with_sentry=True
[build_requires]
[env]
CONAN_USE_ALWAYS_SHORT_PATHS=True
yasm/1.3.0: Not found in local cache, looking in remotes...
yasm/1.3.0: Trying with 'artifactory'...
Downloading conanmanifest.txt completed [0.10k]
Downloading conanfile.py completed [3.91k]
Downloading conan_export.tgz completed [0.37k]
Decompressing conan_export.tgz completed [0.00k]
yasm/1.3.0: Downloaded recipe revision fbd06c2ed3c695843035e75d60777a4e
yasm/1.3.0: Forced build from source
Installing package: yasm/1.3.0
Requirements
    yasm/1.3.0 from 'artifactory' - Downloaded
Packages
    yasm/1.3.0:2d91722813283545a5bec8be869b6396b7c40537 - Build

Installing (downloading, building) binaries...
yasm/1.3.0: Configuring sources in C:\.conan\yasm\1.3.0\_\_\source
Downloading yasm-1.3.0.tar.gz completed [1457.18k]

Downloading YASM-VERSION-GEN.bat completed [1.03k]

yasm/1.3.0: Copying sources to build folder
yasm/1.3.0: Building your package in C:\.conan\yasm\1.3.0\_\_\build\2d91722813283545a5bec8be869b6396b7c40537
yasm/1.3.0: Generator txt created conanbuildinfo.txt
yasm/1.3.0: Aggregating env generators
yasm/1.3.0: Calling build()

----Running------
> set "VSCMD_START_DIR=%CD%" && call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC/Auxiliary/Build/vcvarsall.bat" amd64 && devenv "yasm.sln" /upgrade && msbuild "yasm.sln" /p:Configuration="Release" /p:UseEnv=true /p:Platform="x64" /m:12 /target:yasm /p:PlatformToolset="v142" /verbosity:minimal /p:ForceImportBeforeCppTargets="C:\.conan\yasm\1.3.0\_\_\build\2d91722813283545a5bec8be869b6396b7c40537\source_subfolder\Mkfiles\vc10\conan_build.props"
-----------------
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.9
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
'devenv' is not recognized as an internal or external command,
operable program or batch file.
yasm/1.3.0:
yasm/1.3.0: ERROR: Package '2d91722813283545a5bec8be869b6396b7c40537' build failed
yasm/1.3.0: WARN: Build folder C:\.conan\yasm\1.3.0\_\_\build\2d91722813283545a5bec8be869b6396b7c40537
ERROR: yasm/1.3.0: Error in build() method, line 74
        self._build_vs()
while calling '_build_vs', line 57
        targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True)
        ConanException: Error 1 while executing set "VSCMD_START_DIR=%CD%" && call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC/Auxiliary/Build/vcvarsall.bat" amd64 && devenv "yasm.sln" /upgrade && msbuild "yasm.sln" /p:Configuration="Release" /p:UseEnv=true /p:Platform="x64" /m:12 /target:yasm /p:PlatformToolset="v142" /verbosity:minimal /p:ForceImportBeforeCppTargets="C:\.conan\yasm\1.3.0\_\_\build\2d91722813283545a5bec8be869b6396b7c40537\source_subfolder\Mkfiles\vc10\conan_build.props"
```

</details>



Discussion:
> 'devenv' is not recognized as an internal or external command,

Are you sure that Visual Studio is properly installed?
Yes, it was not a problem before...

devenv is created by conan, right?
vcvarsall.bat was called successfully as I see from the log
Should I report it as a separate issue?

"conan create . yasm/1.3.0@ --build missing
ERROR: Package 00dfe7 has an invalid version number: '1'. Valid names MUST begin with a letter, number or underscore, have between 2-51 chars, including letters, numbers, underscore, dot and dash"

I have no idea, what may be wrong about creating a recipe... 
> devenv is created by conan, right? vcvarsall.bat was called successfully as I see from the log

devenv is not created by conan. devenv is part of Visual Studio. It is called under the hood by conan in `MSBuild` helper if `upgrade_project` is True.
I have re-installed MSVC and I still have the same error...
And now I have checked it on a new fresh installed machine... Still the same...

Resolving patch:
diff --git a/recipes/yasm/all/conanfile.py b/recipes/yasm/all/conanfile.py
--- a/recipes/yasm/all/conanfile.py
+++ b/recipes/yasm/all/conanfile.py
@@ -53,7 +53,7 @@ def _build_vs(self):
             elif self.settings.arch == "x86_64":
                 msbuild.build_env.link_flags.append("/SAFESEH:NO /MACHINE:X64")
             build_type = "Debug" if self.settings.build_type == "Debug" else "Release"
-            msbuild.build(project_file="yasm.sln", build_type=build_type,
+            msbuild.build(project_file="yasm.sln", build_type=build_type, upgrade_project=False,
                           targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True)
 
     def _configure_autotools(self):


Test patch: