Change compose file generated by Visual Studio Docker Tools - visual-studio

I have an ASP.NET Core 2 project that uses the UseWebpackDevMiddleware from Microsoft.AspNetCore.SpaServices.Webpack.
Unfortunately the aspnet webpack node plugin is complaining about Error: ENOENT: no such file or directory, lstat 'c:\ContainerMappedDirectories'. See NodeJS Issue for details.
There's a workaround, but I can't try it out because I cannot change the docker compose file that Visual Studio is generating. The file they generate under obj\Docker\docker-compose.vs.debug.g.yml, always creates a volume from my project to C:\app, but for the workaround I need it to point to G:\.
Any idea how I can force Visual Studio to use different values when it generates these debugger compose files?
This is what the generated file looks like:
version: '3.6'
services:
employeemap.app:
image: employeemapapp:dev
environment:
- DOTNET_USE_POLLING_FILE_WATCHER=1
- NUGET_PACKAGES=C:\.nuget\packages
- NUGET_FALLBACK_PACKAGES=c:\.nuget\fallbackpackages
volumes:
- C:\Users\nswimberghe\projects\EmployeeMap\EmployeeMap.App:C:\app
- C:\Users\nswimberghe\onecoremsvsmon\15.0.27428.1:C:\remote_debugger:ro
- C:\Users\nswimberghe\.nuget\packages\:c:\.nuget\packages:ro
- C:\Program Files\dotnet\sdk\NuGetFallbackFolder:c:\.nuget\fallbackpackages:ro
entrypoint: C:\\remote_debugger\\x64\\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /timeout:2147483646
labels:
com.microsoft.visualstudio.debuggee.program: "\"C:\\Program Files\\dotnet\\dotnet.exe\""
com.microsoft.visualstudio.debuggee.arguments: " --additionalProbingPath c:\\.nuget\\packages --additionalProbingPath c:\\.nuget\\fallbackpackages bin\\Debug\\netcoreapp2.0\\EmployeeMap.App.dll"
com.microsoft.visualstudio.debuggee.workingdirectory: "C:\\app"
com.microsoft.visualstudio.debuggee.killprogram: "C:\\remote_debugger\\x64\\utils\\KillProcess.exe dotnet.exe"
There are other containers in the composer file which I removed for simplicity.
Only the employeemap.app should use G:\.

Add new file "docker-compose.vs.debug.yml" to your docker-compose project.
Fill it like this
version: '3.6'
services:
employeemap.app:
volumes:
- .\EmployeeMap.App:G:\
labels:
com.microsoft.visualstudio.debuggee.workingdirectory: "G:\\"

Related

Why is .NET6 self-containing app too slow?

I have app in .NET6, my deployment manager needs them as a self-contained. So, I have changed YAML build command to following:
- task: DotNetCoreCLI#2
displayName: Publish service
inputs:
command: publish
projects: <my project>.csproj
publishWebProjects: True
arguments: '--self-contained true --configuration $(BuildConfiguration) --no-restore --output "$(Build.ArtifactStagingDirectory)\service" -p:Version=$(GitVersion.FullSemVer) /p:DebugType=None /p:PublishTrimmed=true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:InformationalVersion=$(GitVersion.InformationalVersion)'
zipAfterPublish: false
In project file there are added new elements:
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
and appsettings.json files have added elements:
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
There is really produced a "single file" deployment (only file: Microsoft.Data.SqlClient.SNI.pdb lies next to).
But starting of the app takes ~ 30 minutes!? Reactions are 1000 times slower in comparation with non-self-contained deployment
What's wrong? How to diagnose it please?
Thanks for your answers, Petr

MySQL Workbench Version 8.0.17 dies silently on MacOS Mohave 10.14.6

MacOS Version: 10.14.6 Mohave
MySQL Workbench: 8.0.17
Fresh installed (tried uninstall -> install) but not able to understand why it keeps on dying silently. The log file has following contents:
14:26:57 [INF][ Workbench]: Starting up Workbench
14:26:57 [INF][ WBContext UI]: Initializing workbench context UI with these values:
base dir: /Applications/MySQLWorkbench.app/Contents/Resources
plugin path: /Applications/MySQLWorkbench.app/Contents/PlugIns
struct path: /Applications/MySQLWorkbench.app/Contents/Resources/grt
module path: /Applications/MySQLWorkbench.app/Contents/PlugIns:/Applications/MySQLWorkbench.app/Contents/Resources/plugins
library path: /Applications/MySQLWorkbench.app/Contents/Resources/libraries
user data dir: /Users/mg/Library/Application Support/MySQL/Workbench
open at start:
open type:
run at startup:
run type:
Force SW rendering: No
Force OpenGL: No
quit when done: No
14:26:57 [INF][ WBContext]: WbContext::init
The logs goes silent post this. No idea, what am I missing.

How to setup CI/CD for nativescript using Visual studio online/Azure dev ops tools

Im try so setup a CI/CD Pipeline for a Nativescript app, added the commands to install node and npm install but nativescript has dependencies that it need. How do I go about on Azure dev ops dynamically without having to create a vm that has nativescript and all its dependencies installed and setup
So i have used a VM and install nativescript on it and used and agent to connect to the machine and build solution, i have done the same using jenkins but jenkins was running on the vm, no i want to move the whole pipeline on azure dev ops
command used in build step: tns build android
If you don't want to use a vm you'll have to install everything needed for nativescript before building it on their hosted agent each time you create a build for your app.
A couple of important things to note. First the name of your repository is changed to 's' this messes with the naming of your entitlement file... or at least it did for me. I fix this with a bash file I add to my repository that changes the name of the path in build.xcconfig for the CODE_SIGN_ENTITLEMENTS variable. I added an npm run entitle command in my package.json file to run this before building. Second you'll want to store all files and secure passwords in the library section under pipelines in you Azure Devops project. Third, Using the classic editor is your best friend for figuring out yaml as most jobs have an option to view the YAML. You can also use the classic editor as an alternative to the YAML file
The YAML and bash file below show an example of how you can build an ipa and apk file that is stored as an artifact. You can then use that trigger a release pipeline to push the the play and app store.
# YAML File
name: Release Build
trigger:
- release/* # will start build for pull request into release branch ie. realease/version_1_0_0, release/version_2_0_0
pool:
vmImage: 'macOS-10.13'
variables:
scheme: 's' # default name/scheme created on this machine for ipa
sdk: 'iphoneos'
configuration: 'Release'
steps:
- task: NodeTool#0
inputs:
versionSpec: '10.14'
displayName: 'Install Node.js'
# Download Secure File for Android
# Note: if multiple secure files are downloaded... variable name will change and break pipeline
- task: DownloadSecureFile#1
displayName: 'download android keystore file'
inputs:
secureFile: myKeystore.keystore
#Install Apple Certificate(Distrobution)
- task: InstallAppleCertificate#2
displayName: 'Install an Apple certificate Distribution (yourcertificate.p12)'
inputs:
certSecureFile: '00000000-0000-0000-0000-000000000000' # got id from viewing file in clasic editor for pipeline
certPwd: '$(myCertificatePasswordP12)' # password stored in Library
# Install Apple Provisioning Profile(Distrobution)
- task: InstallAppleProvisioningProfile#1
displayName: 'Apple Provisioning Profile(myProvisioningProfile.mobileprovision)'
inputs:
provisioningProfileLocation: 'secureFiles' # Options: secureFiles, sourceRepository
provProfileSecureFile: '00000000-0000-0000-0000-000000000000' # Required when provisioningProfileLocation == SecureFiles
# General Set Up
- script: |
npm install -g nativescript#latest
npm install
displayName: 'Install native script and node Modules'
# variable explination
# $DOWNLOADSECUREFILE_SECUREFILEPATH is keystore file downloaded earlier
# $KEYSTORE_PASSWORD refers to the environment variable in this script which references library variable
# $(MyPlayStoreAlias) refers to library variable for your apps alias
# $BUILD_SOURCESDIRECTORY location where apk is built to
# Android
- script: |
tns build android --env.production --release --key-store-path $DOWNLOADSECUREFILE_SECUREFILEPATH --key-store-password $KEYSTORE_PASSWORD --key-store-alias $(MyPlayStoreAlias) --key-store-alias-password $KEYSTORE_PASSWORD --bundle --copy-to $BUILD_SOURCESDIRECTORY #creates apk
displayName: 'Build Android Release apk'
env:
KEYSTORE_PASSWORD: $(MyPlayStoreKeystore)
# create apk artifact
- task: PublishBuildArtifacts#1
inputs:
pathtoPublish: '$(Build.SourcesDirectory)/app-release.apk'
artifactName: 'apkDrop'
displayName: 'Publishing apkDrop artifact'
# have to use xcode 10.1 to meet min standards for uploading ipa... default version for this machine was lower than 10.1
#changing xcode version
- script: |
xcodebuild -version
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"
xcodebuild -version
displayName: 'changing xcode to 10.1'
# Optional... was running into build issues with latest version
#downgrading cocoapods version
- script: |
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.5.3
displayName: 'Using cocoapods version 1.5.3'
#iOS
- script: |
xcodebuild -version # makeing sure the correct xcode version is being used
pip install --ignore-installed six # fixes pip 6 error
npm run entitle #custom bash script used to change entitlement file
tns run ios --provision #see what provisioning profile and certificate are installed... helpful for debugging
tns build ios --env.production --release --bundle #creates xcworkspace
displayName: 'Build ios Release xcworkspace'
#build and sign ipa
- task: Xcode#5
displayName: 'Xcode sign and build'
inputs:
sdk: '$(sdk)' # custom var
scheme: '$(scheme)' # must be provided if setting manual path to xcworkspace
configuration: '$(configuration)' # custom var
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '/Applications/Xcode_10.1.app' #using xcode 10.1
xcWorkspacePath: 'platforms/ios/s.xcworkspace'
exportPath: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)' #location where ipa file will be stored
packageApp: true #create ipa
signingOption: manual
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' # distribution certificate
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)' # distribution profile
#creating ipa artifact
- task: PublishBuildArtifacts#1
displayName: 'Publishing ipaDrop artifact'
inputs:
pathtoPublish: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)/s.ipa'
artifactName: 'ipaDrop'
Bash file
#!/usr/bin/env bash
# filename: pipeline-entitlements.sh
echo "Editing build.xcconfig"
TARGET_KEY="CODE_SIGN_ENTITLEMENTS"
REPLACEMENT_VALUE="s\/Resources\/YOURENTITLEMENTFILENAME.entitlements"
CONFIG_FILE="./app/App_Resources/iOS/build.xcconfig"
echo "Editing $TARGET_KEY and replaceing value with $REPLACEMENT_VALUE"
sed -i.bak "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE
echo "Finished editing build.xcconfig"

How to set build configuration-dependent variable in AppVeyor

For the Debug build configuration of Visual Studio, I want to exclude certain tests from CTest. My idea was to do something like
matrix:
- configuration: Release
environment:
EXCLUDETESTS: ""
- configuration: Debug
environment:
EXCLUDETESTS: "solver"
i.e. creating a corresponding string environment variable called EXCLUDETESTS per configuration.
But this gives me Error parsing appveyor.yml: "matrix" section must be a mapping. (Line: 15, Column: 3), though the syntax should be fine according to http://yaml-online-parser.appspot.com/
The complete appveyor.yml file reads
version: "{build}"
os:
- Visual Studio 2017
- Visual Studio 2015
# x64 is a CMake-compatible solution platform name.
# This allows us to pass %PLATFORM% to CMake -A.
platform:
- x64
# Build Configurations, i.e. Debug, Release, etc.
# EXCLUDETESTS determines which tests will not be run
matrix:
- configuration: Release
environment:
EXCLUDETESTS: ""
- configuration: Debug
environment:
EXCLUDETESTS: "solver"
environment:
- PYTHON: "C:\\Python36-x64"
# Cmake will autodetect the compiler, but we set the arch
before_build:
- set PATH=%PYTHON%;%PATH%
- set CXXFLAGS=%additional_flags%
- cmake -H. -BBuild -A%PLATFORM% -DUI_CXX_USE_QT=OFF
# Build with MSBuild
build:
project: Build\spirit.sln # path to Visual Studio solution or project
parallel: true # enable MSBuild parallel builds
verbosity: normal # MSBuild verbosity level {quiet|minimal|normal|detailed}
install:
- "%PYTHON%/Scripts/pip.exe install numpy"
test_script:
- cd Build
- ctest --output-on-failure -C %CONFIGURATION% -E %EXCLUDETESTS%
Please check Exclude configuration from the matrix. Something like this should work for you:
configuration:
- Debug
- Release
environment:
matrix:
- EXCLUDETESTS: solver
- EXCLUDETESTS:
matrix:
exclude:
- configuration: Release
EXCLUDETESTS: solver
- configuration: Debug
EXCLUDETESTS:

GitLab CI. Path in yml for different users

I'm trying to set up GitLab CI for .net project. Now I'm writing script in yml file. What I want to know: the path to the msbuild.exe and mstest.exe may be different for the different team members, how the same yml script may work for different users?
Or may be I'm understand how GitLab CI work in wrong way?
The path to the mstest.exe and all other referenced executable and files is based on the machine that has the GitLab runner running.
What's on your machine or anyone else's doesn't matter; Only the build server matters, so write your gitlab .yml accordingly.
Sample .net yml file
##variables:
## increase indentation carefully, one space per cascade level.
## THIS IS YAML. NEVER USE TABS.
stages:
- build
- deploy
#BUILD
# Builds all working branches
working:
stage: build
except:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
# Builds all stable/master pushes
stable:
stage: build
only:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
#DEPLOY
stage: deploy
only:
- dev
script:
- echo "Deploy Stage"
#SEND TO YOUR DEV SERVER
## deploy latest master to the correct servers
stage: deploy
script:
- echo "Deploy Stage"
only:
- master
#SEND TO YOUR PRODUCTION SERVER
tags:
- .NET
#put tags here you put on your runners so you can hit the right runners when you push your code.

Resources