CopyFilesToOutputDirectory log relative path - msbuild

I have big log file for logging compile output from MSBuild and I am looking for a way how can I clean this file by logging only relative path from absolute path.
For now I have logging like this one:
CopyFilesToOutputDirectory:
Copying file from "E:\Data\Jenkins\workspace\develop_BUILD_CH\ux1\fol1\fol2\obj\Release\xyz.pdb" to "E:\Data\Jenkins\workspace\develop_BUILD_CH\out\Release\xyz.pdb".
and I want to get something like this:
ux1\fol1\fol2\obj\Release\xyz.pdb

Related

How can I target a nested directory in .prettierignore?

I would like to write a .prettierignore file to target the files in a single directory, which is nested one level down from the root of the project. I figure the most elegant way to accomplish this is to use a negated pattern to ignore everything but the target directory.
So, I currently have this:
# Ignore all
/*
# but for /views
!src/views/
Running the npx prettier --write . command with that pattern (or similar variations) appears to match no files, and no files change. However, if I run the command without/views in the pattern, i.e. just !src, then prettier formats everything in the src directory, including all the files in /views.
What am I missing that I can't successfully target only the nested /views directory?
After some more searching, I found this solution, which accomplishes the outcome I was seeking, though, I don't quite understand how it works.
#ignore all
/*
#but don't ignore files or directories at root called src
!/src
#ignore everything in src dir?
/src/*
#but don't ignore views dir in src?
!/src/views
Why would that be necessary compared to just src/views?

Is it possible to setup the file watcher in LESS to have the output file with different name from the source?

I'm working with a style.less file and I'd like to know if it's possible to output a theme.css file when I compile. How can can configure the file watcher to achieve this?
Here's my current configuration:
Sure - just specify theme.css as a target file name:

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

Compiling haml from a different directory

I use this to launch my haml compile:
/install-location/haml /myproject/index.haml /myproject/index.html
It runs fine when I'm in the directory with the haml file but when I change to a different directory I get:
Exception on line 3: No such file or directory # rb_sysopen - assets/page/structure/_head.haml
Use --trace for backtrace.
What can I do to fix this?
The path you are trying to read — assets/page/structure/_head.haml is relative to the working directory, not to the source file directory. When you’re in the same directory it works because these two directories are the same.
To be able to run the code from a different directory you need to use absolute paths. You can convert the relative path to an absolute one with File::expand_path, File::dirname and __FILE__:
= Haml::Engine.new(File.read(File.expand_path 'assets/page/structure/_head.haml', File.dirname(__FILE__))).render

How to specify root folder for Package target?

I publish my web application using msbuild by calling following command:
msbuild myweb.csproj /T:Package /P:PackageLocation=obj\Output\myweb.zip
The content of zip file has always deep folder structure containing full path from drive root to the project folder. Is there any way how to make it more flat? I would like to have a project folder like root in zip.
You can use _PackageTempDir instead of PackageLocation for IIS-like flat structure, but if you want to keep the .zip and .cmd with manifests then no, you can't really get away from absolute paths without rewriting Microsoft.Web.Publishing.targets or a custom task due to the way the var is used.
<_PackageTempDir>$(PackageTempRootDir)\PackageTmp</_PackageTempDir>
<_PackageTempDirFullPath>$([System.IO.Path]::GetFullPath($(_PackageTempDir))</_PackageTempDirFullPath>
<_MSDeployDirPath Include="$(_PackageTempDir)" />
<_MSDeployDirPath_FullPath>#(_MSDeployDirPath->'%(FullPath)')</_MSDeployDirPath_FullPath>
You can however trick msbuild and flatten it a little bit by hiding the absolute path with a local share, something like this:
net share foo=D:\Temp
msbuild WebApplication1.csproj /t:Package /p:PackageTempRootDir=\\localhost\foo
That'll change your deep local path to something like obj\Debug\Package\WebApplication1.zip\Content\_S_Slocalhost_Sfoo\PackageTmp