how does msbuild decide which tools to use? - msbuild-4.0

I'm trying to setup a new TeamCity agent.
My new agent is calling:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe
While the existing agents are calling:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\AMD64\CL.exe
The existing agents are doing the right thing as far as I'm concerned, because both are 64bit host and building 64bit binaries. Both are calling msbuild with the same arguments (specifics removed to protect the innocent):
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe (xxxx.sln /clp:PerformanceSummary /p:Configuration=Release /p:Platform=x64)
I've found this blog: http://blogs.msdn.com/b/aaronhallberg/archive/2007/07/16/msbuild-property-evaluation.aspx, which explains how msbuild evaluate properties. But I don't know what properties are used to decide about the tools.
You might wonder why I care about the tool choice. The CL calls succeed in either case (you can run the 32 bit compile under 64bit windows). But on the new agent, I'm getting an error on a pre-compiled header "precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)" - and the pre-compiled header is being consumed by the same AMD64\CL.exe.
So if anyone knows which props msbuild actually uses, it would help me figure this out.
As a side note, I see the cross compiler (x86_amd64\CL.exe) in Visual Studio projects property pages under VC++ Directories, Executable Directories, on my workstation. Which is Win 7, 64bit. It says it is inherited, and I haven't customized the msbuild props (in C:\Users\bdelavega\AppData\Local\Microsoft\MSBuild\v4.0). Why would that be the default?

This post explains that msbuild defaults to using the cross compiler when called from VS 2010 and that there is a command line switch to override it.
http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/d6b352ea-12b6-4867-b86d-a052fbab1da4
It's not the complete answer, but it gives me enough to overcome my issue.

Related

Use a SSIS package as Template in SSDT for Visual Studio 2017 Community

. Hi everybody!, I'm running into a small problem.
I have VS 2017 Community Edition, I've installed SSDT (SQL Server Data Tools)
I've built an SSIS package (a generic one) and now I would like to use it as a template for future packages.
So, I was digging in the web, also here in StackOverflow and found for example this article:
Setting up SSIS Item Template in SQL Server Data Tools for Visual Studio 2012
I found lot of other articles in MS for example:
https://learn.microsoft.com/en-us/sql/integration-services/create-packages-in-sql-server-data-tools
others, etc. and followed up to the tee but, for some reason I can't make it work.
This is my folder structure for my VS installation
I've left out of the tree some folders that doesn't apply to the problem
I put my package in the places I found in the articles and didnt work.
Sometimes, in the articles mentioned folders that I didn't have so I created and tried but nothing also (so deleted this folders)
I'm really lost, I tried everything I read, and some "creative things" from my yard but no results.
Anyone has come through this or has some experience about this issue?
Anyone can help?
Thank you very much.
Best regards and Happy new year!!
Gabriel
Well based on the articles I've read and the help of #billinkc, I finally figured out where to put the package, I was missing something also, but I realised when I read #billinkc answer.
When you are on VS Community Version, you have to put the package in this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\SSIS\ProjectItems\DataTransformationProject\DataTransformationItems
The files you need to make it work are, a dtsx file (the package that will be the template) and a vsdir file which mainly needs to have this structure I used this values and worked fine:
YourPackageName.dtsx| |The name you want to appear|100|The description of the package| |21| |#44
You can check all the fields of the vsdir file in the MS documentation:
https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/template-directory-description-dot-vsdir-files
So now I have it running!
Thanks for your help!!
I don't have 2017 installed but this appears to work for 2015 so if you don't mind being a guinea pig...
Close out all instances of Visual Studio
Copy your template package into Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems
Open your SSIS project
Right click on the project and select Add, New Item and you should have your template package listed (TemplatePackage2)
For reference, below is what my folder structure looks like. Since I couldn't remember whether the package templates lived at DataTransformationProject or DataTransformationProject\DataTransformationItems, I put a copy of my template package in both, varying by name to see what was picked up in the editor
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationProjectItems.vsdir
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\TemplatePackage.dtsx
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems\DtsProjectItems.vsdir
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems\TemplatePackage2.dtsx
General notes about templates
The first is that the only way to get to your template is through the click path described above. If I want to add a new package, my default click path is right click on SSIS Package and select "New SSIS Package"
Pre-2012, the internal IDs of components and the package would remain the same. BIDS Helper had functionality to address this. Why it mattered was if you were attempting to track performance for packages, if they all report the same GUID you're going to have a hell of a time discerning whether Data Flow Task that ran for 10 hours is the same one that normally takes 10 seconds or was a second (different) package executed.
Developers will need to be local administrators on their machine to deploy the template package(s) and you'll need a process to keep that up to date. That or you need to engage the network admins to get these copied to developer machines.
Finally, if I had template logic, I'd probably abstract that away into Biml and then use source control to ensure people are working with the current version and avoids the whole permission issue.

SSIS via MSBuild - Could not load ...DTSRuntimeWrap

I'm using the CodePlex-hosted Microsoft.SqlServer.IntegrationServices.Build project to build a DLL that contains the MSBuild tasks for building SSIS packages via MSBuild.exe.
I also am using an MSBuild proj file that's floating around the web.
More here:
https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/
I've opened the CodePlex project, disabled signing, switched it to 4.6.1 and built the DLL and corrected paths etc. and go it semi-working. However MSBuild spits this error:
Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
I've installed SSDT latest for Visual Studio 2015. I have various SQL Server editions installed on my dev PC. The DLL seems to be present; I've copied all I need into one folder for the moment.
Open the CodePlex project again and remove the reference to Microsoft.SqlServer.ManagedDTS.
Look on your local disk for the missing Microsoft.SqlServer.DTSRuntimeWrap.dll and note the version(s) you have available.
Now look on your disk for Microsoft.SqlServer.ManagedDTS.dll and note the version(s).
Re-add the reference but make sure you pick a DLL for which you also have the version of the 'wrap' available.
Now make sure those DLLs are (re)copied over into your working folder or whatever.
If you're still having problems, you may need to copy some files around so that MSBuild.exe can find them or edit/create a config file for MSBuild.
How to solve: Custom MSBuild task requires assembly outside of AppBase

Windows: How to compile WPF XAML-based program from command line?

I'm not very impressed with Visual Studio Express 2013, which is the free version of Visual Studio. I would greatly prefer to just compile my C# program form the command line. I've located the compiler csc.exe and I located the DLL files for .NET, but how can I compile a XAML file?
You want to use MSBuild (MSDN). This is the standard way to compile .NET projects from command line. This is also the compiler that Visual Studio uses internally. You have to have a .csproj/.sln file for it to work, but it will be the fastest and most effective way to get to where it sounds like you want to be.
You're looking for MSBuild. Visual Studio projects are XML scripts for MSBuild. To build a project or solution, you can use the following commands:
MSBuild MyApp.sln
MSBuild MyApp.csproj
Building XAML files is far from trivial and C# compiler isn't enough for this. The most recent MSBuild targets for XAML is in the C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Xaml.targets file. But doing all this manually isn't the best idea, you'll just overcomplicate things even if you manage to do everything without MSBuild.

Error MSB4062 when trying to build my CUDA program

I get the following error when I try to build my first GPU Program. Any suggestions what might be going wrong?
Error 1 error MSB4062: The "Nvda.Build.CudaTasks.SanitizePaths" task
could not be loaded from the assembly C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\Nvda.Build.CudaTasks.dll.
Could not load file or assembly 'file:///C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\Nvda.Build.CudaTasks.dll'
or one of its dependencies. The system cannot find the file specified.
Confirm that the declaration is correct, that the assembly
and all its dependencies are available, and that the task contains a
public class that implements
Microsoft.Build.Framework.ITask. C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA
3.2.targets 70 4 gpu
I have faced with this problem. So many searching on internet but I could not find anything. At last I recognize that I closed Microsoft .NET Framework 3.5.1 features on Windows Features section in Control Panel.
to turn on Microsoft .Net Framework 3.5.1, you can easily follow these instructions;
http://www.sevenforums.com/tutorials/5023-windows-features-turn-off.html.
I hope this solution will help you !
I've come across this problem after upgrading my system to windows 10. It turns out that I have to reinstall Visual Studio because some dependent dlls have been moved to Windows.old folder.
I had this same error when I was compiling on a remote server. I think it was because I was logged in using Remote Desktop (RDP). When I logged in using VNC and compiled, the error no longer happened.
Note that it's impossible to even install the CUDA Toolkit via RDP, so this is unlikely to happen, unless you regularly use both methods to connect to a server.

Error compiling CUDA from Command Prompt

I'm trying to compile a cuda test program on Windows 7 via Command Prompt,
I'm this command:
nvcc test.cu
But all I get is this error:
nvcc fatal : Cannot find compiler 'cl.exe' in PATH
What may be causing this error?
You will need to add the folder containing the "cl.exe" file to your path environment variable. For example:
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
Edit: Ok, go to My Computer -> Properties -> Advanced System Settings -> Environment Variables. Here look for "PATH" in the list, and add the path above (or whatever is the location of your cl.exe).
For new Visual Studio cl.exe is present in path => C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64
x64 is for 64bit
x86 is for 32bit
Solve this problem by adding this options to nvcc
nvcc x.cu ... -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
for example my compiler is VS2012. and cl.exe is in this dir
cl.exe is Microsoft's C/C++ compiler. So the problem is that you don't have that installed where the command line can find it.
nvcc is only a front end for the CUDA specific part of the program. It must invoke a full compiler to finish the job. In this case it cannot find the Visual Studio compiler 'cl.exe'
Check paths, nvcc documentation etc.
I see that this is an old question but I recently got this error on my Visual Studio 2012 when I tried to build my CUDA project. Apparently I had changed my CUDA project to the Nov 2012 pack, changing it back to the v110 that it usually is by default fixed this error.
In Visual Studio, left click on the CUDA project, ->properties->Configuration Properties-> General -> Platform toolset, and choose: Visual Studio 2012 (v110).
I could probably get it to work with the Nov 2012 pack, but the CUDA code does not use any of the additional functions of that pack, so it is not necessary. (That pack contains the variadic templates for C++11.)
Solve this problem by adding the path to environment variables, which can vary slightly depending in the version of visual studio installed in your system, and are you using 32bit or 64bit system
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64