MSBuild on Centos returns "The imported project "/Microsoft.Cpp.Default.props" was not found" - linux

I'm trying to build a VS project in CentOS. I installed dotnet-sdk-2.2 via yum install dotnet-sdk-2.2.
When executing dotnet msbuild myproj.vcxproj I get:
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
mtproj.vcxproj(19,3): error MSB4019: The imported project "/Microsoft.Cpp.Default.props"
was not found. Confirm that the path in the <Import> declaration is correct, and that the
file exists on disk.
Googling results with many solutions but for Windows. what can I do to resolve this over Linux/CentOS?

According to your error message it's a C++ project.
Please check this document,the dotnet CLI only supports .NET / .NET Core / .NET Standard projects.
C++ projects are part of the visual studio tooling (c++ workload). The dotnet CLI doesn't contain the visual c++ compiler or the necessary windows SDKs. So it's not supported to build C++ projects directly using dotnet msbuild in Windows, not to speak of CentOS.
To build C++ projects in linux, you can try g++ compiler, you can find many related info about how to use it online.
Also, maybe you can try using GCCBuild to build vcxproj files in Linux. It simple uses same structure of vcxproj but uses GCC to compile and build. Thanks to Roozbeh.

Related

MSBuild using the wrong cl.exe when building with the 2015 C++ v140 Platform Toolkit

We're currently making a build environment for some of our projects.
In particular we're using VC++ 6.0 and VS2019 to build some of these projects.
When building our C++ project in VS2019 with the Platform Toolkit set to C++ 2015 v140, MSBuild attempts to use the VC++ 6.0 compiler to build the project. If I switch the Toolkit to any other version it builds with the correct cl.exe.
If I remove the VC98 folder that contains cl.exe from the path environment variable I get a cl.exe can't be found error in VS2019.
So I think there's something hardcoding the 2015 toolkit against the VC6.0 cl.exe.
I've tried installing and reinstalling the additional components in the VS Installer but no luck.
Repair of VS2019 didn't fix it either.
I've tried all versions of Visual Studio back to 2013 same issue.
This looks like an MSBuild issue, it's in the wrong location.
Is there any place where I can view the mapping for the toolkits in MSBuild? I couldn't see much in the registry.
The output when I build shows the following, the version is clearly a very old compiler (the VC6.0 one):
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86

Unable to build for Debug|x64 using MSBuild and VC++ Express edition

I have machine with VC++ Express Edition installed. And also .Net frameworks 2-4. I want to use msbuild through command line to build a VC++ project.
Issue is the build runs fine for Configuration=Debug;Platform=Win32 but for Configuration=Debug;Platform=x64 it gives an error that:
"….vcproj" (Clean;Build target) (1) ->
(Clean target) ->
vcbuild.exe : error VCBLD0004: Project ….vcproj' does not contain a configuration called 'Debug|x64'.
However if I view .csproj file directly it does have that configuration. I feel the issue is the missing x64 build tools. But while installing VC++ Express Edition it doesn't give an option to include x64 build tools like you get during complete Visual Studio 2008 installation.
So how can I get around that given that, I can't install a complete VS like there is on development environment because of several restriction.

How to build with v90 platform toolset in VS2012 without VS2008, using Windows SDK?

I use Visual Studio 2012 and this is the only version of Visual Studio I have installed. I need to build certain C++ projects with the v90 platform toolset (of Visual Studio 2008), but I can't install Visual Studio 2008.
I understand it is possible to use the v90 platform toolset by installing Windows SDK 7.0. How exactly is it done? If I simply use the web installer of 7.0 SP1, I still don't see v90 as one of the possible platform toolsets.
It is possible, but apparently requires some maneuvering and will not support building MFC applications. The following assumes that VS2012 update 4 is installed, but neither VS2010 nor VS2008 are installed.
Download the x86 DVD of SDK 7.0 SP1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the following folders under the Setup folder:
WinSDK (this may fail, it's ok)
WinSDKBuild
WinSDKInterop
WinSDKTools
WinSDKWin32Tools
vc_stdx86
vc_stdamd64
winsdk_intellidocs
WinSDKIntellisenceRefAssys
WinSDKNetFxTools
Download the x86 DVD of SDK 7.1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the same folders listed above (except winsdk_intellidocs, which doesn't exist).
Go to C:\Program Files (x86)\Microsoft Visual Studio 9.0. Copy the following files from Common7\IDE to VC\bin:
msobj80.dll
mspdb80.dll
mspdbcore.dll
mspdbsrv.exe
Now you should be able to choose the v90 platform toolset in Visual Studio 2012 and build with it.
Explanations (and sources):
Individual MSI installation is based on the second workaround from this connect report.
The requirement for both 7.0 and 7.1 is based on this question (both VS2010 and VS2008 are required to use v90 in VS2012!). SDK 7.1 is not needed if you have VS2010.
DLL/EXE copying requirement is based on yet another question. If you do not copy them, you will see error MSB6006: "CL.exe" exited with code -1073741515.
In addition to this answer I want to add that
You can install SDK 7.0 simply by running setup, there is no problem with it.
You can install SDK 7.1 by running setup, if you remove Microsoft Visual C++ 2010 Redistributables first and fix following registry values:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full]
"Version"="4.0.30319"
You can (and probably should) restore these values to whatever they originally were after installation is complete.
Do not forget to install KB2519277 after this, it updates compilers in SDK 7.1 to SP1.
You don't need to copy any dll. MSBuild uses
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VC#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VS#ProductDir
to set up paths. It's probably wise to fix them to point to "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\" and "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\" as it might be useful elsewhere in build process.
Same goes for version 10.0 if you plan to use Windows7.1SDK toolset.
Use WindowsSdkVer.exe to set current SDK to 7.1 to defeat cryptic error in Microsoft.Cpp.x64.Targets(63,5) about missing unnamed required file. If the tool gives you error, then set these values manually:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows#CurrentInstallFolder
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows#CurrentInstallFolder
to point to newly installed SDK. The tool needs some registry keys from Visual Studio installation to work properly, but there are many and I'm not sure which are important.
Reboot. None of the above asks you to, but without reboot I got errors when trying to build a project.
As an aside, SDK7.1 adds v100 toolset, but it won't work, saying something about Could not find WindowsSDKDir variable from the registry. This is because v100 actually requires SDK7.0A which comes with Visual Studio 2010 and is not available separately. Windows7.1SDK toolset is the one which utilises VC2010 compilers if you need them.
Microsoft.Cpp.Win32.*.props files have a lot of relevant stuff if something fails in build system.
One addition/update for VS2013 to Yodans answer:
My working setup:
VS2013 has to use VS2010 libs
Using WinSDK 7.1 (Yodans 2.) build tools (v100) in VS2013
clean install, uninstalling everything mentioned in the sdk release notes (can be downloaded at http://www.microsoft.com/en-us/download/details.aspx?id=8279 under category Details)
Microsoft Windows SDK for Windows 7 (7.1) (the Windows SDK core-component files)
Application Verifier
Debugging Tools for Windows
Windows Performance Toolkit
Microsoft Help Viewer 1.0
Microsoft Visual C++ 2010 Redistributable
Microsoft Visual C++ 2010 Standard Edition
Additionally removed all .NET and VC++ related MS Software (not tested if necessary)
choosing Windows7.1SDK as Platform Toolset in VS2013
error MSB6006: "CL.exe" exited with code -1073741515
cl.exe uses msobj100.dll, mspdb100.dll, mspdbcore.dll and mspdbsrv.exe
Added to PATH C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Build works and binary is usable ( So now its tested Yodan ;-) )
My mistake:
copied files in 7. above to C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin (Yodans 3.), believing this dir is in PATH, but it was not!
So better do as sugested by Yodan and tested by myself in 8. above
p.s. same answer is solving this problem:
Visual Studio 2013: CL.exe exited with code -1073741515

Generate CUDA program dlls under Linux

I know that mingw creates a dll file under windows which can be used to create an exe file. We can execute this exe file in windows. I am working on a cuda project under Linux, but have to deliver the product for Windows as well. Is it possible to generate a dll file using some sort of method under windows?
On windows, MinGW is not supported for CUDA development. The only compiler which is officially supported by CUDA is cl.exe which ships with Microsoft Visual Studio.
More details can be found in System Requirements section of CUDA Getting Started Guide.
Here is an MSDN tutorial which describes how to create a C++ DLL using Visual Studio.
For compiling CUDA kernels, you would have to add CUDA Build Rules in the Build Customizations section of the Visual Studio DLL project.

PhoneGap add wp8 platform requires MSBuild x86

When trying to add the wp8 platform to a project, using:
phonegap local build wp8
It fails. Requiring msbuild x86.
C:\Program Files (x86)\MSBuild\Microsoft\WindowsPhone\v8.0\Microsoft.WindowsPhon
e.v8.0.Overrides.targets(15,9): error : Building Windows Phone application using
MSBuild 64 bit is not supported. If you are using TFS build definitions, change
the MSBuild platform to x86. [C:\funiz\platforms\wp8\Funiz.csproj]
ERROR: MSBuild failed to create .xap when building cordova-wp8 for debugging.
This is a Windows 8.1 machine, with Visual Studio Ultimate 2013, Update 2 RC.
The PATH environment variable is set to:
C:\Users\Yoram Kornatzky\AppData\Roaming\npm;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v4.0.30319
I tried removing the Frame64 element from the PATH. But it still fails.
Any insight would be appreciated.
You haven't specified the build template you are using. But if you are using DefaultTemplate in your team build definition, change value of parameter "MSBuild Platform" from Auto to X86

Resources