Where to find MSBuild 14.0 x64 - c#

I'm setting up a script that builds my C# solution from command-line. It works fine, but currently it runs MSBuild as 32-bit application and I want it to be ran as 64-bit.
Maybe I'm missing something obvious, but I can't find how to run MSBuild as 64-bit executable.
First I tried to use C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe, but this is wrong version.
So I found C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe which is version 14.0 (now I have both Visual Studio 2015 and Microsoft Build Tools 2015 installed), but it runs as 32-bit application (or I'm missing something)?
I expected to see some .exe in C:\Program Files where other 64-bit exes are stored, but nothing there.
My machine is 64-bit Quad Intel Xeon.
Maybe before calling MSBuild I should call some cmd-file to setup environment properly? Like vcvarsqueryregistry.bat?

Well, yes it was like in VS 2012 and VS 2013 in amd64 subfolder:
C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe

Related

ERROR: Unrecoverable build error - 0x8007000B - VS2022 Winforms Project C#

I tried this ways in two differents computers Win10:
Registering MergeMod and Ole32(with Admin Privileges)
Delete project setup and create again
Reinstalling VS Installer Projects 2022
Updating & Restarting the computer
It's the same, I have hours with this problem.
I create a project with VS2019 with a copy/paste of the files and works!
but with VS2022 failed
If anyone has the same situation with VS2022 and could solve, I'd love to hear about it!
Thanks!
0x8007000B is ERROR_BAD_FORMAT and most likely occurs when you are mismatching 32-bit and 64-bit binaries. You're likely incorrectly registering a 32-bit DLL but trying to run it in a 64-bit exe (or the reverse situation could possibly be true too.)
If this is a plug-in to Visual Studio, please note that the Visual Studio IDE itself is now a 64-bit process, as of Visual Studio 2022, so your old 32-bit plug-ins may not work with the new 64-bit Visual Studio without being rebuilt to be compatible with a 64-bit host process.

How to compile my c# solution with msbuild from command line

I have a c# solution (open source, available here: https://github.com/tzachshabtay/MonoAGS) which I can compile fine from Visual Studio 2017 (Dot net framework) and from VS for Mac (Mono). I can also compile it with msbuild on Travis CI successfully on both linux and mac (https://github.com/tzachshabtay/MonoAGS/blob/master/.travis.yml).
What I can't do, is compile it on command-line from Windows 10 on my local machine. I'd like to be able to compile it both for DotNet Framework and Mono.
So I tried using MSBuild from both the mono installation and from the Build Tools for Visual Studio 2017 (note: I want to be able to install on windows even if vs2017 is not installed, though on the local machine vs2017 is installed, don't know if it matters).
Both installations are for the latest versions as of today.
This is the error I get from msbuild on mono (PATH was set to %programfiles(x86)%\Mono\bin):
Project "C:\Github\MonoAGS\MonoAGS.sln" (1) is building "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) on node 1 (default targets).
Project "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) is building "C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj"
(3) on node 1 (GetTargetFrameworks target(s)).
C:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props(29,11): error MSB4226: The imported project "C:\
Program Files (x86)\MSBuild\15.0\Microsoft.Common.props" was not found. Also, tried to find "15.0\Microsoft.Common.prop
s" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths
are defined in "C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\MSBuild.dll.config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths. [C:\Github\MonoAGS\Source\AGS.
API\AGS.API.csproj]
And here's the error I get from msbuild from build tools (PATH was set to %programfiles(x86)%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin):
Project "C:\Github\MonoAGS\Source\Tests\Tests.csproj" (2) is building "C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj" (3) on node 1 (GetTargetFrameworks target(s)).
C:\Github\MonoAGS\Source\AGS.API\AGS.API.csproj : error MSB4247: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGet
SdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtens
ions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll
As for the mono error, the MSBuild\15.0 folder exists but Microsoft.Common.props is not there (and I couldn't find it anywhere else on that machine).
As for the build tools error, the CommonExtensions folder exists but there is no Microsoft folder in it.
The command I'm trying is:
msbuild /p:Configuration=DEBUG /p:Platform="Any CPU" MonoAGS.sln
Why doesn't it work? What am I missing?
Thanks.
How to compile my c# solution with msbuild from command line
For the build tools error, you should install the component NuGet package manager by Visual Studio Installer:
When we use the Visual Studio build tool to build our project, we also need to install some of the necessary components for our project.
For the mono error, since I do not have mono ENV, I could not specify the directly reason for that error, if possible, you can try to install Mono framework. If it not helps, you can open a new thread with mono and msbuild tags.
Update:
How do I install it with command-line, btw (for setting up a script)?
Yes, you can use vs_buildtools.exe to install that component ID Microsoft.VisualStudio.Component.NuGet:
vs_buildtools.exe --add Microsoft.VisualStudio.Component.NuGet --quiet
Note: You should rename vs_buildtools__2048890300.15156xxxx.exe to vs_buildtools.exe, then use vs_buildtools.exe to install it.
Check the Visual Studio Build Tools 2017 component directory and Use command-line parameters to install Visual Studio 2017 for some more details.
Hope this helps.

Crash when running C# app with CPP\CLR on windows server 2012

I am using CLR to run a pre-compiled dll from C++ in a C# environment and experiencing differences between win server 2012 and win 7\win server 2008.
While in windows 7 or windows server 2008 the program works fine, but when trying to run in server 2012 I get:
"dll or one of its dependencies is not a valid win32 application"
Any known issues\solutions to this problem?
(OS is always 64, .net 4.5, VS 2013)
(Attached picture show the dll in Dependency walker under both OS)
Dependency walker on Windows server 2012
Dependency walker on Windows 7
You are missing the C++ run-time libraries on your server. Specificly, from the file name MSVCP100D.DLL I can tell that you need the debug version of the "Microsoft Visual C++ 2010 Redistributable", which is not allowed to be redestributed (as opposed to the release version which you can find here)
You can find the debug version of the run-time library inside the Visual Studio 2010 folder in the VC\redist\Debug_NonRedist folder. (Disclaimer: I don't have 2010 installed, but 2013 and 2015) As a workaround you can copy the missing dlls to the same folder you have your dll in.
To prevent having this problem in the future, either get a non-debug version of the DLL and install the public runtime redistributable or compile a static build (which includes those libraries in the DLL thus making it larger), debug or not.

where to find Microsoft.VisualStudio.QualityTools.Resource.dll?

I am in the process to setup our new Win7 build machine for our C# project. We don't want to install Visual Studio on that machine. So I am following the instruction "Running mstest without Visual Studio" to setup our machine.
On step 3:
Put Microsoft.VisualStudio.QualityTools.Resource.dll and
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll in the GAC on the CIServer,
because that is where they are on the DevMachine.
On my develoopment machine (installed Visual Studio 2008 professional version) I found both of them in my GAC (C:\windows\assembly) but I searched my entire development machine and couldn't find the Microsoft.VisualStudio.QualityTools.Resource.dll
My questions are:
where to get the Microsoft.VisualStudio.QualityTools.Resource.dll?
can I copy above file from GAC? (I tried gacutil.exe, there is no such copy option. I tried Control Panel->Administrative Tools, but my XP machine only has Microsoft .Net Framework 1.1 Configuration on which above two assembly didn't show up.)?
thanks,
You can copy files from the GAC via cmd.exe. E.g.:
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll C:\Temp
Adjust the version appropriately.
Windows Explorer just replaces the subfolders in C:\Windows\assembly with the aggregated view you might know.
my Version Of this Dll currently sites at the following location C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 due to using vs2010 so change the path accordingly to get it from your machine
if you need to run this in isolation create a tools folder in your folder structure thats checked into source control and then reference the dll from that tools folder and NOT from the GAC. this means that when it builds on the build machine it wont need Visual Studio installed
Maybe you have a 64 bit machine. In that case, it's here.
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Run the command below if you use VS2008
copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll c:\temp

Visual studio installer error with Visual C++ 2017 Runtime Libraries (x64) prerequisite

I've created the installer for my project without a problem, In project's properties, I included Visual C++ 2017 Runtime Libraries (x64) 2010 and 2017.
But during the installation in the client host, I've got a 'The following package files could not be found:' without specifying much more information.
Is when I checked the temp directory that I've discovered that 'vc2017redist_x64' haven't copied.
With the 2010 version, it seems to work rightly.
Anyone have experienced the same problem?
I'm using Visual Studio 2017 15.9.17.
Finally I came up with the solution.
The path of the VC++2017 installer in the default bootstraper package was wrong and installation failed.
So I had to edit the manifest file in
C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\ and set the right path.
Once modified, it worked!
Please notice that you can also find the bootstrapper folder location from the Path value in the following registry key:
HKLM\Software\Microsoft\GenericBootstrapper
On 64-bit systems, use the following registry key:
HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper

Categories

Resources