How do I turn off code analysis? In the c++ vcxproj project properties, I've tried unchecking my_proj.vcxproj -> properties -> code analysis -> enable code analysis on build. However, when I build with verbose logging, I can see code analysis in the build command.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\CL.exe" /c /I<lots_of_include_paths> /Zi /JMC /nologo /W4 /WX /diagnostics:classic /sdl /MP3 /Od /D CODE_ANALYSIS ... /analyze /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\localespc.dll" /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\EspXEngine.dll" ... my_file.cpp
Within this command there are 2 sections that start with "/analyze:plugin". One for EspXEngine.dll and one for localespc.dll. localespc has been causing problem on some machines at work so I want to delete it from the build command. I suspect there is something in the vcxproj xml but I haven't found it yet.
I tried adding `/analyze- /analyze /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\EspXEngine.dll" to additional properties. This works but give new warnings on D9025.
Missing from my original question was order of the XML in my .vcxproj. I don't know how but my <PropertyGroup...><RunCodeAnalysis>... was near the bottom of the file. Deleting the block and letting visual studio recreate it using the checkbox, placed it higher up in the XML.
Microsoft Documentation states that Order Matters in the vcxproj file which is defined here. https://learn.microsoft.com/en-us/cpp/build/reference/vcxproj-file-structure?view=msvc-170#impact-of-incorrect-ordering
Related
I'm setting up a Jenkins job for a Windows 10 application.
I need to compile one of the four projects inside the solution with devenv.com executable because it is a project with .vdproj extension (setup project).
The other projects are built successfully with MSBuild without any problem.
The Jenkins job ends successfully when I'm logged in as root on a Jenkins target node, but, fails when I run the job from Jenkins and I'm not logged in.
Need your help or workaround to solve the issue.
PS: we are using ant as task runner and we have a specific task that start the build process.
EDIT 26/01/2017
I would like to provide you other informations like the error message and one step that I've skipped before.
The error message provides a link to a Microsoft Page and reports a configuration problem.
As solved by this StackOverflow post, I've added a new DWORD registry key under
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild
Can the problem be that this value can't be readed when the User is'nt logged in ?
EDIT 27/01/2017
I'm going crazy with this issue.
The command devenv /? work fine when i run it locally but wont work when i run it from Jenkins with the same error as before: Microsoft Visual Studio found a configuration problem. To fix it restart as administrator or visit http://go.microsoft.com/fwlink/?LinkId=659046 for further information.
So the devenv.com cannot be executed when i'm not logged in ??
UPDATED 31/01/2017#
Here's my .bat file called from a target by ant build.xml
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"
#set MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"
%MSBUILD% "%cd%\src\AutomatedSetupBuild.proj"
pause
Where the AutomatedSetupBuild.proj is an MSBuild script
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="Build">
<PropertyGroup>
<DevEnv>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com</DevEnv>
<SolutionFile>$(MSBuildProjectDirectory)\MySolution.sln</SolutionFile>
<ProjectFile>MySetupProject\MySetupProject.vdproj</ProjectFile>
<Configuration>Release</Configuration>
</PropertyGroup>
<Exec
Command=""$(DevEnv)" "$(SolutionFile)" /Rebuild "$(Configuration)" /Project "$(ProjectFile)" /ProjectConfig "$(Configuration)" /Log vs.log /useenv"
ContinueOnError="false"
IgnoreExitCode="false"
WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>
</Project>
As you can see, I'm loading the environment variable before run devenv.com but i receive the same error.
Do you use a free style job or do you use a Jenkinsfile for a pipeline project? In any case, for devenv.com to work, environment variables have to be set up.
Please go to the Windows start menu and look for something like Visual Studio XX -> Visual Studio Tools -> Developer Command Prompt for VS20XX. Press right mouse bottom and select properties. There look for target. In my case this field contains the following string:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat""
If you use e.g. a Jenkinsfile, change the call to devnenv.com, which probably looks like
bat "devenv.com my_solution_file.sln /project my_project /build \"Release|x64\""
to
bat "call \"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat\"; devenv.com my_solution_file.sln /project my_project /build \"Release|x64\""
It is important, that the call to the VsDevCmd.bat is within the same bat command. Otherwise the environment variable settings get lost and are not seen by a second call to bat.
Open the dev command prompt type "where devenv" then call the full path with the .com version... e.g.
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.com" /Rebuild "RELEASE|Win32" "F:\project.sln"
For my part, I had to convert the Visual Studio 2015 SSRS project to SSRS Visual Studio 2017. Then I installed the 2017 SSDT for VS 2017, and use MSBUILD. Everything works well without open remote session.
Since VS2010, Microsoft Visual Studio introduces the Platform Toolset concept that encapsulate the traditional global INCLUDE, LIB, PATH settings inside various Toolsets. I admit that's an improvement for flexibility, but it should not be a blackbox that makes us foolish.
Now my question is, how do I know what the resulting INCLUDE, LIB, PATH are when I apply a Toolset to my project. I think it is not realistic to analyze those hundreds of .targets and .props files(in C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120) manually to get the result. Most of the time, we just need the result. Is there any concise way to achieve that?
==== UPDATE ====
Stijn provides the right answer for me. Now I can see PATH= , LIB= , INCLUDE= ... from the build log. But, a minor question, what is the difference of LIB and LIBPATH?
1>Using "SetEnv" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CppTasks.Common.dll".
1>Task "SetEnv"
1> PATH=C:\VS2013\VC\bin;;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools;C:\VS2013\Common7\Tools\bin;C:\VS2013\Common7\tools;C:\VS2013\Common7\ide;C:\Program Files (x86)\HTML Help Workshop;;C:\Program Files (x86)\MSBuild\12.0\bin\;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;C:\Windows\SysWow64;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;;C:\Windows-Kits\8.1\bin\x86;C:\Windows-Kits\8.1\tools\tracing\x86
1>Done executing task "SetEnv".
1>Task "SetEnv"
1> LIB=C:\VS2013\VC\lib;C:\VS2013\VC\atlmfc\lib;;
1>Done executing task "SetEnv".
1>Task "SetEnv"
1> LIBPATH=C:\VS2013\VC\atlmfc\lib;C:\VS2013\VC\lib;
1>Done executing task "SetEnv".
1>Task "SetEnv"
1> INCLUDE=D:\u8vc\USBview\C++\;C:\VS2013\VC\include;C:\VS2013\VC\atlmfc\include;;
The easisest way is probably to adjust the msbuild log settings so the INCLUDE/LIB/PATH environment variables are printed to the output window. In Visual Studio's options you can either:
set Projects and Solutions->VC++ Project Settings->Show Envirohnment In Log to Yes
set Projects and Solutions->Build and Run->MSBuild project build output verbosity to Detailed or Diagnostic
Then in the build log grep for INCLUDE etc
For command line builds use the /v:d switch with MSBuild.
I've created a custom data source using the instructions given in the following link:
http://msdn.microsoft.com/en-us/library/ms136088.aspx
However once i build the project and try to add the new datasource to the toolbox, i get the following error:
There are no components in
'C:\Somepath\bin\Debug\CustomDataSource.dll' that can be placed on the
toolbox
following are the tools i've used:
To create and build the custom datasource;
Visual Studio 2010 & build in Framework 3.5
To create the SSIS package
SSIS - SQL Server 2008 R2 & SQL Server Business Intelligence Development Studio (VS2008)
Any help would be greatly appreciated.
Nandun
i found the answer to my problem; here's the solution and hope it helps someone.
ref - http://msdn.microsoft.com/en-us/library/ms403356.aspx
copy the dll to the following folder(s). the exact folder depends on whether your on x64 or x86 (doesn't hurt to have it on both):
C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents
C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents
Install the dll to your GAC. you will need to have it signed to do this.
In BI Dev Studio, go to Tools > Choose Toolbox Items. you will find your data source in the "SSIS Dataflow Items" tab
For steps 1 & 2 you might find it helpful to have a post build event like follows:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" -u $(TargetName)
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" -iF $(TargetFileName)
copy $(TargetPath) "C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents"
copy $(TargetPath) "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents"
Small Edit to the answer:
If you're using SSIS 2012 with BIDS 2010, the toolbox items get added automatically (i.e. u don't have to go to Tools > Choose Toolbox Items) you just need to copy it to the dll right places (ref - http://fendy-huang.blogspot.com/2011/09/how-to-add-ssis-custom-component-to.html):
C:\Program Files\Microsoft SQL Server\110\DTS\PipelineComponents
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\PipelineComponents
C:\Program Files\Microsoft SQL Server\110\DTS\Tasks
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Tasks
There is a report here that a similar problem was resolved by making the class public. (Also, signing the assembly and placing it in the GAC.)
Here is a case where someone needed to to implement IComponent and inherit from Component class.
I see number of other posts when I google the error message. Did any of these help?
I am copying .exe file form a separate to my main project's folder on prebuild event but I need to build that project before build my main project so i want to build that project on prebuild event of my main project.
Not that this is the best solution, but it will definitely work for what you want to do: Put the below into your pre-build event
"$(VS100COMNTOOLS)..\IDE\devenv" "csproj location OR sln location" /Rebuild "configuration required if you have more than configuration ex: Debug|x64"
This is what worked for me:
"$(DevEnvDir)devenv" "$(SolutionDir)MySolution.sln" /Build $(configuration) /project "$(SolutionDir)MyProjectFolder\MyProject.csproj"
Here $(DevEnvDir), $(SolutionDir), and $(configuration) are Visual Studio Macros, so this command will be translated into:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv" "D:\Learning\MySolutionFolder\MySolutionName.sln" /Build Debug /project "D:\Learning\MySolutionFolder\MyProjectFolder\MyProject.csproj"
"$(DevEnvDir)devenv" "$(SolutionPath)" /Rebuild $(configuration) /project "$(SolutionDir)MyProjectFolder\MyProject.csproj"
Tested now on Visual Studio Community 16.11.1
Using the below command in visual studio 2019, build is faster with msbuild as compared to "$(DevEnvDir)devenv".
msbuild "$(SolutionDir)Sample.sln" /p:configuration=$(configuration)
I'm trying to suppress the command-line from the output in Visual Studio - my plan is to add /nologo to the command-line - but I can't find a place in the application settings or in the IDE settings to do this.
I'm probably missing something obvious, but would really appreciate any enlightenment.
Edit: What is causing me the problem can best be described by the following scenario:
I have a solution with multiple projects
I hit F7, to build all (or all currently configured to build via the Configuration Manager)
I hit F4 to step through the warnings/errors in the project(s)
At the start of every project's output (which is usually 0 warnings and 0 errors) is a statement such as the following:
"c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:pdbonly /filealign:512 /optimize+ . . ."
The fact that these are output for every project (esp. when those projects don't have warnings or errors) makes my stepping any bona-fide warnings/errors a right royal PITA. I want to have the IDE not display these pointless information lines.
Tools | Options | Projects and Solutions | Build and Run | MSBuild project build output verbosity -> Quiet
The question isn't quite clear. By default in VS2005, if you right-click a project, select properties, and look under Configuration Properties -> C/C++ -> General, I think you'll see Suppress Startup Banner: Yes (/nologo)
This suppresses some banner info from the compiler. Is that what you want?