TFS PowerShell task not producing output when used with devenv - visual-studio-2017

I can't use MSBuild to compile SSIS projects as it's not supported yet. Hence,
I'm trying to use VS2017 devenv.exe to compile SSIS projects in my TFS (2017) task via PowerShell. I don't see any errors but neither I see the compiled output from dtproj files i.e. dtsx or ispac.
However, if I run the same powershell command manually on the build agent machine then it works fine and produces the output files. This is the command I'm trying:
$VsIdeExe = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe'
$BuildConfiguration = 'Development'
$PackageStagingLogsDirectory = "C:\temp\logs"
& "$VsIdeExe" "C:\temp\Source\SSIS\MyData.sln" /build "$BuildConfiguration" `
/log "$PackageStagingLogsDirectory\MyData.ide.log" `
/out "$PackageStagingLogsDirectory\MyData.sln.log"
What am I missing here?

I found an alternative and it works. So, instead of using PowerShell task, I used Command line task and it works like a charm! I don't know how the mechanics are different between these 2 tasks but my use case sufficed.
Thanks!

Related

Visual Studio cross platform makefile project, command not found

I'm trying to build a cross platform project for Ubuntu. In my makefile I have the line
"PSPSDK=$(shell psp-config --pspsdk-path)"
which gives the error "psp-config: Command not found."
psp-config is in my path and running make from the Ubuntu system on the files that get copied over from Visual Studio works fine. It also works if I manually ssh into the Ubuntu system from windows and run the command from there.
Why can't it find the command when run through Visual Studio?
You should update PATH at the beginning of "~/.bashrc" file (and not at the end) because it starts with somethign like:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Also, if you add code before these lines, it will be invoked for every subshell execution, so it is better to add a guard for it as well so it is invoked only once per session:
if [ -z $HOME_OPT_PATH_SET ]; then
export PATH=$PATH:$HOME/opt
export HOME_OPT_PATH_SET=1
fi
# If not running interactively, don't do anything
...

MSBuild does not work anymore with Tokyo

I have multiple project groups that I want to compile at batch. There are over 100 projects in there.
In 2010 we had a "make" file like this:
call "c:\Borland\RAD Studio\19.0\bin\rsvars.bat"
"c:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /t:Clean,Build Group1.groupproj
Under Tokyo it does not work anymore.
I get:
C:\Borland\RAD Studio\19.0\Bin\CodeGear.Cpp.Targets(3695,5): error : Error: Unable to open file 'L_ER_FD.RES' [P:\Ent\_common\er\prj\l_er_fd.cbproj]
However, the project group compiles just fine from IDE.
We think it is related to the creation of the .vres file (from .rc) which are create in memory by the IDE and never written to file.
Notes:
- I tried this from C++ Builder Tokyo but I guess it happens also under Delphi. I will test that soon.
- I have MSBuild v12.
I had the same problem and I managed to get around it. So I had the following script on older version of Rad Studio and it was working:
call rsvars.bat
call msbuild Utils25.cbproj /t:Clean;Build /p:Configuration=Release /p:platform=Win32 > result.err
but on Rad Studio 10.2.3 this was producing me a linking error like yours. After a lot of testing I found that if you do clean and build on separate msbuild calls it works as expected. So the following works:
call rsvars.bat
call msbuild Utils25.cbproj /t:Clean /p:Configuration=Release /p:platform=Win32 > clean.err
call msbuild Utils25.cbproj /t:Build /p:Configuration=Release /p:platform=Win32 > build.err

TestStack White - Run tests from command line

I'm looking for a solution to start my tests from command line.
I created a UnitTest Procjet in VisualStudio2017 for my .NET solution.
Added TestStack.White NuGet package to the project.
The test are running fluently when I start from the VisualStudio2017.
I would like to start it from Jenkins also. I think it is the easiest to do it from command line, so I add it to my pipeline configuration (Jenkinsfile)
stage('Run UI Tests') {
steps {
bat('"C:\\PATH_TO_MSTEST\\mstest" /testcontainer:PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
When I try to start it from cmd like I would do with with regular Unit Tests, it is not working.
It says:
Starting execution...
No tests to execute.
I build the project before I start 'Run UI Tests' stage.
Any ideas how to make it work? Could really find it on stackoverflow, github issues of TestStack nor other glory places on the web
Found a solution.
On my local developer machine it was working, the mstest version was 14
On the build agent machine the mstest version was 15, that was not working somehow (it had nothing to do with TestStack White, simply the unit tests were not working)
What I do is, calling vstest.console.exe instead of the mstest.
C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe
So, instead of
stage('Run UI Tests') {
steps {
bat('"C:\\PATH_TO_MSTEST\\mstest" /testcontainer:PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
My command in the Jenkinsfile was:
stage('Run UiTests') {
steps {
bat('"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe" PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
}
}
nunit3-console is great alternative to MSTEST. Please refer below link.
e.g.
nunit3-console \bin\Debug\Automation.dll --where "cat=Smoke-Tests"
https://github.com/nunit/docs/wiki/Console-Command-Line

LNK1181 error when compiling V8 engine on Win10

I'm following this guide on building V8 but I am hitting some issues on the compilation step. I am running Windows 10 x64. I am trying to compile with options to embed the engine also.
Running the following command:
ninja -C out.gn/x64.release
Gives me this error:
ninja: Entering directory `out.gn/x64.release'
[1/471] LINK mksnapshot.exe mksnapshot.exe.pdb
FAILED: mksnapshot.exe mksnapshot.exe.pdb
C:/Workspace/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./mksnapshot.exe /PDB:./mksnapshot.exe.pdb #./mksnapshot.exe.rsp
LINK : fatal error LNK1181: cannot open input file 'comdlg32.lib'
ninja: build stopped: subcommand failed.
Now I believe I have narrowed down the error to looking for the .lib files in the wrong directory. I have (had) multiple versions installed, so there were multiple folders in my Windows Kit install.
Windows Kits/10/Lib/10.0.16299.0
Windows Kits/10/Lib/10.0.15xxx.0
If I dragged and dropped the comdlg32.lib file from 10.0.16299.0 into the 10.0.15xxx.0 directory then the error changed to a LNK1181 error with a different input file. I did this a few times but I was unsure if this was going to cause issues with different versions and there was probably going to be a lot.
I uninstalled the 10.0.15xxx.0 version which left behind the folder I mentioned, so I removed that and after doing so I have started getting the LNK1181 error with a different input file (advapi32.lib I assume the very first file it can't find). This is how I came to the conclusion about the path being incorrect.
So I have tried a few things to change the path (I hoped just uninstalling the old version would fix it) such as:
Uninstalling the old version.
Going through registry entries to see if I can find an install path or something using that path, which I didn't. I did notice that there was still installation and data in the registry for the 10.0.15xxx.0 install, I might try deleting that from the registry directly as a last resort?
I have tried to explicitly set the path by setting <TargetUniversalCRTVersion>10.0.16299.0</TargetUniversalCRTVersion> in this file: C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\uCRT.props
I have never used Ninja before so I tried looking for a way to set some kind of lib-path in the command but couldn't really find anything.
I looked through the python scripts being executed to try and locate something to do with the libs path but couldn't see anything.
I would be grateful for any help and suggestions. Thanks.
You can try to compile v8 using Visual Studio as explained here: https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#using-the-visual-studio-ide
By running the following commands:
$ gn gen --ide=vs out.gn/x64.release
$ cd out.gn/x64.release
$ msbuild all.sln
You can see a full example here: https://github.com/phpv8/v8js/issues/272#issuecomment-262848754
Apparently this method is not officially supported anymore, but I had the same problem as you have and this solved the issue for me.
Note that after this I had another issue, the unit tests failed to be compiled due to a linking error, but I had the necessary libraries to use v8. So there may be deeper problem that is causing all of this that I'm missing.
Edit:
Also, you could try to set the following parameters with gn args:
visual_studio_path = "..."
visual_studio_version = "2017"
wdk_path = "..."
windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
To set those parameters, do:
gn args out.gn/x64.release
This will open a text editor where you can write the extra parameters you are interested in.
To see the full list of parameters you can specify:
gn args --list out.gn/x64.release
I was following this guide https://medium.com/dailyjs/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4 and also ran into the error
LINK1181: cannot open input file 'advapi32.lib'
I'm pretty sure it was because I had the wrong versions of the Windows 10 SDK. Similar to you I had versions:
Windows Kits/10/Lib/10.0.10240.0
Windows Kits/10/Lib/10.0.16299.0
But according to https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#Setting-up-Windows (Which I think is relevant) you need version 10.0.15063.0
After installing version 10.0.15063.0 (with the visual studio installer) to
Windows Kits/10/Lib/10.0.15063.0
I was able to continue with the build.

How to execute process before build multiple projects in a solution

I'm using VS2010 on Windows 7 Ultimate x64.
I want to build multi-project in one solution automatically.
For example : )
Solution StormSolution contains 4 projects.
1 : Storm_Module1 (output file extension : dll)
2 : Storm_Module2 (output file extension : dll)
3 : CombineModule12 (output file extension : dat)
4 : ConvertModule2CFGFile (output file extension : cfg)
Step 1,2 : A result of Storm_Module1 and Storm_Module2 are Standard Windows DLL.
Step 3 : A result of CombineModule12 is open Storm_Module1.dll and Storm_Module2.dll to make "combined.dat" file, like cmd.exe /c copy /b storm_module1.dll + storm_module2.dll combined.dat command.
Step 3-1 : Then, make combined.dat file into encrypted_combined.dat file with encryption_tool.
Step 4 : Open "encrypted_combined.dat" file and make it into own specified cfg file.
The problem occurs on Step 4. I can't build solution storm automatically.
Because I've to make "combined.dat" result of Step3 into "encrypted_combined.dat" with encryption_tool.
So, if I build Storm solution without any action, ConvertModule2CFGFile project can not open latest updated encrypted_combined.dat.
How can I execute encryption tool before on Step4.
Encryption tool can be executed with parameters.
ex:) cmd.exe /c "encryption tool.exe -mode_crypt combined.dat -output encrypted_combined.dat.
Is it impossible to execute process before build project?
In Visual Studio you can create Post-Build Events which can execute a batch file. Use that to combine your two DLLs.
To make your projects build in the correct order, adjust Build Dependencies and Build Order in your Solution/Projects.
Consider writing a batch file for Visual Studio Command Prompt - it will enable you to build solutions 1 & 2 first, then you can perform any operation on files you like and call your encryption tool easily, and then build the last solution.
This thread should get you started:
How to create a Batch File for Visual Studio Command Prompt