I have some really old scripts using the build command for compiling with WDK 7. A sample command to build a static library is:
build /F /g /w /b /c /Z /jpath %BUILDROOT%
What is equivalent command I can use to compile the same with WDK 10?
Also where can I find documentation on the usage of the build command.
While going through a MSDN documentation of MSBuild I came across this:
Important Starting in Windows Driver Kit (WDK) 8, MSBuild replaced the
Windows Build Utility (Build.exe).
So that's it - no build command for WDK 8+.
Converting the earlier project into a WDK 10 format - by generating the vcxproj files, I was able to build it.
Microsoft has replaced Build with MSBuild. The reference is MSBuild Reference. Note that Visual Studio uses MSBuild, even for WDK projects. It will take time to create VS projects but if the code is to edited more than a little it will be worth doing that.
There is a chance however that you can just change Build to MSBuild.
Related
Currently on Window's 10 with Visual Studio Build Tools installed, elixir 1.10.4, erlang/otp 22. I'm trying to run an api locally that is built on phoenix/elixir, and am running into an error where argon2_elixir cannot compile, and the error causing it is "nmake" not found in path. I have been trying to research the issue and most solutions say to make sure Visual C++ build tools are installed, and that didn't seem to help the situation.
Any help would be greatly appreciated!
With newer Visual Studio versions, nmake.exe is located in a path which depends on the exact version of the C++ runtime/build tools. To locate it in a mostly version independent fashion, I use a batch script containing the following code snippet:
set VSPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
for /f %%i in ('dir "%VSPATH%\VC\Tools\MSVC" /b') do set VCTOOLSVERSION=%%i
set NMAKE="%VSPATH%\VC\Tools\MSVC\%VCTOOLSVERSION%\bin\HostX86\x86\nmake.exe"
(for the 64 bit version replace HostX86\x86 by Hostx64\x64).
You can surely adapt this to your needs, for example, for finding the folder to nmake.exe and adding it to the PATH environment variable.
Building a windows xp application using Visual Studio 2015 IDE isn't hard at all, you just need to use the right platform toolset (v120_xp or v140_xp) and just make sure you install the proper redistributable visual studio runtime dlls on the target machine, easy peasy.
Now, I've been trying to figure out how to build a windows xp application targetting windows xp without using the VS GUI but using VS2015 command line + SCons
All the SCons flags are docummented here but I don't see anything that allows me to change the platform toolset.
If you wonder what's the real meaning of the platform toolset flag... after some research I've been able to figure out what that flag really does is basically producing different PE headers that are suitable for the target machine loader, you can see a little comparison between 4 different cases below (v120, v120_xp, v140, v140_xp):
Question: How can i change the visual studio platform toolset when using visual studio command line or when using visual studio command line + SCons?
EDIT: I've found this Can I set the platform toolset from the command line when building with VS2010's msbuild? but I'm not sure whether that could be used via SCons :/
After a lot of digging I've found out the best strategy to know more about the platform toolset meaning was comparing manually how this flag would affect both cl and link, I've already done that and here's my findings:
v120_xp
-------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_"
v120
----
link: /SUBSYSTEM:CONSOLE
cl:
v140_xp
--------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_" /Zc:inline
v140
-------
link: /SUBSYSTEM:CONSOLE
cl: /Zc:inline
I've extracted out all common parameters and left only the relevant ones affected by platform toolset. In order to know more about this whole subject I'd recommend you to read specially about the /SUBSYSTEM flags from official docs.
Also, the Executable/Include/Library/Exclude directories will be adjusted to use windows SDK 7.
Remaining thing is to integrate these flags with SCons, that should be easy enough, for instance, you just need to adds these flags to the nuitka environment
I'm using
cd C:\Program Files (x86)\Microsoft Visual Studio\VB98
vb6.exe /make Project1 /out %1
To basically compile my application, and I'm getting a compatibility issue (Saying doesn't work on my type of windows).
When compiling with the VB6 IDE (Make .exe) that works perfectly on my machine but this isn't, does anybody know how to fix this? Thanks
Error I receive when trying to open executable: "This version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 32-bit or a x64 64-bit version of the program, the contact the software publisher".
& It's a standard EXE application also.
I've tried running it as a administrator, trouble shooting / changing the compatibility to windows XP service pack 2 & 3, still didn't work.
Work prefer a good fix to this, like if there's anything I can do via console as a option or something or some option or anything.
Cheers! Please help ASAP
From the discussion in the comments, I believe the answer here is as follows (as identified by GSerg):
The problem is your use of the /make switch on the command line. The documentation says this about /out:
Outputs errors to a file when used with the /make or /makedll switch.
So, if you used vb6.exe /make Project1 /out Project1.exe, then Project1.exe would actually be a text file containing the error output from the compiler and thus would not be an actual executable, even though it had an .exe extension.
You actually don't specify the output binary when you use /make. The help output from running VB6.exe /? is a little more explicit:
Tells Visual Basic to compile projectname and make an executable file
from it, using the existing settings stored in the project file.
VB remembers the last filename and directory you used for compiling your project in the IDE, and it stores that in the .vbp file:
ExeName32="Project1.exe"
Path32="..\output"
I use a batch file to handle this issue. It sets the path to include both the 32-bit and 64-bit versions of the Program Files directories. Then just reference 'vb6.exe' and the correct one will be pulled from your path.
set PATH=c:"\Program Files (x86)\Microsoft Visual Studio\VC98\bin"
set PATH=%PATH%;c:"\Program Files (x86)\Microsoft Visual Studio\VB98"
set PATH=%PATH%;c:"\Program Files\Microsoft Visual Studio\VC98\bin"
set PATH=%PATH%;c:"\Program Files\Microsoft Visual Studio\VB98"
vb6 /m foobar.vpb
Is there any way to create a windows 8 winjs .appx package file using command line?
Yes! Look for the MSBuild.exe executable in the .NET Framework folder. You run it like:
MSBuild.exe your/project.jsproj /p:Configuration=Release /t:Build /m
You can use "Debug" instead of "Release" and also "Deploy" instead of build (which will install the app locally, if not previously installed).
More at the MSBuild reference.
There are some usage samples in the Rainbowdriver project, which uses MSBuild to automatically test Windows 8 JS Apps using Selenium.
I have a C++ project (some sort of a console 32-bit appplication) developed in VS2010, which builds just fine on my PC (Windows 7 32-bit). My PC has Microsoft SDK 7.0A installed, which I think comes bundled with VS2010.
I try to build the project on a build server, which doesn't have any Visual Studio installed - only Microsoft SDK 7.1 is present there.
I try to build the project with the help of msbuild (this will eventually become the task for TeamCity's runner), and on the build server I get following errors (the detailed log is provided):
Project "E:\win\core.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Win32".
Project "E:\win\core.sln" (1) is building "E:\win\core_unittests.vcxproj" (2) on node 1 (default targets).
Project "E:\win\core_unittests.vcxproj" (2) is building "E:\cpptest\win\cpptest.vcxproj" (3) on node 1 (default targets).
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(847,9): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [E:\cpptest\win\cpptest.vcxproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [E:\win\cpptest.vcxproj]
InitializeBuildStatus:
Touching "E:\cpptest\win\..\..\..\out\Debug\cpptest\cpptest.unsuccessfulbuild".
ClCompile:
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"E:\cpptest\win\..\..\..\out\Debug\cpptest\\" /Fd"E:\cpptest\win\..\..\..\out\Debug\cpptest\vc100.pdb" /Gd /TP /analyze- /errorReport:queue ../missing.cpp
missing.cpp
e:\cpptest\missing.cpp(36): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory [E:\cpptest\win\cpptest.vcxproj]
I suppose the issue is related to inability of msbuild to find Microsoft SDK, which is installed into "E:\Program Files\Microsoft SDKs\Windows\v7.1".
There are few advices how to handle this issue available on the Web:
Copy part of registry under HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1 to HKCU (see WindowsSdkDir is not set correctly in Visual Studio 2008?). I didn't try this workaround because as it looks too ugly, and the build process will run with SYSTEM-account credentials.
Pass WindowsSDKDir as an extra parameters to MSBuild (as proposed in TeamCity and MSBuild Quirks #1).
Tweaking VCProjectEngine.dll.config.xml as proposed in the answer to Include Search Paths in TeamCity build Configurations (I haven't found such file on the PC with Windows SDK).
Change the platform toolset in the project properties as proposed in the answer to WindowsSdkDir is not set correctly in Visual Studio 2010 (I doubt this will help, because my PC doesn't have Windows SDK 7.1 installed).
Actually when compiling with CL.EXE everything goes fine (because I have INCLUDE and LIB variables defined), so it would be a workaround to force msbuild to use/pass the environment variables...
There are similar issues:
"Differences between building on a machine with VS2010 installed and on a machine with the 7.1 SDK installed" but for .NET projects.
Erroneous Windows SDK x64 Compilation Warning (building 32-bit project for 64-bit platform).
Anyway has anyone succeeded with building Visual C++ 2010 projects on a PC with Windows SDK installed?
I've finally found some kind of a workable and meaningful workaround for the issue - inside "Can we build *.vcxproj(c++ project) using MSBuild 4.0 without installing the Visual Studio 2010?".
In short: I have to explicitly specify the Platform Toolset when building the solution on a PC without VS2010. The command will look like:
msbuild /p:PlatformToolset=Windows7.1SDK core.sln
You will probably need to go same way if your project has v100 or v90 specified as the Platform Toolset.
And an extra hint for TeamCity's enthusiasts, running the server on a PC with a lone Windows SDK installed.
Instead of modifying all build steps, it is enough to specify the Platform Toolset in the agent's properties.
To do that add following line to ?:\TeamCity\buildAgent\conf\buildAgent.properties:
system.PlatformToolset=Windows7.1SDK
Happy building! :)
Also you can add this node & value to registry (correct with your install dirs & win 32/64 version).
---begin .reg file---
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS]
"ProductDir"="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\"
---end .reg file---
because of MSBuild script
%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\Windows7.1SDK\Microsoft.Cpp.Win32.Windows7.1SDK.props" search for VSInstallDir.