ClickOnce: Custom boostrapper package - winforms

I'm trying to create a custom boostrapper package for a click once app. I've added the product.xml+the msi package to a folder (named CCSdk) which was created under the C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages (I've also copied the folder into C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages). My product.xml file is rather simple and looks like this:
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="CCSdk">
<RelatedProducts>
<DependsOnProduct Code=".NETFramework,Version=v4.5" />
</RelatedProducts>
<PackageFiles>
<PackageFile Name="PteidMW-Basic-64.msi"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Property="IsMsiInstalled" Product="{824563DE-75AD-4166-9DC0-B6482F205284}"/>
</InstallChecks>
<Commands>
<Command PackageFile="PteidMW-Basic-64.msi" Arguments="">
<InstallConditions>
<BypassIf Property="IsMsiInstalled" Compare="ValueGreaterThan" Value="0"/>
<FailIf Property="AdminUser" Compare="ValueNotEqualTo" Value="True" String="NotAnAdmin"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" String="GeneralFailure"/>
</ExitCodes>
</Command>
</Commands>
</Product>
My problem is that I still don't see my custom bootstrapper package when I try to add prerequisites on publish settings.
what am I missing?
Thanks
Luis

Can you try generating the package using the Bootstrapper Manifest Generator and comparing the output? The tool was apparently retired from MSDN but is still available here:
http://www.softpedia.com/get/Programming/Other-Programming-Files/Bootstrapper-Manifest-Generator.shtml

Related

How to Properly Reference Assemblies in DNN Manifest?

I'm writing a DNN 9 custom module using ASP.NET MVC. My development site is setup at dnndev.me and the module is located in C:\websites\dnndev.me\DesktopModules\MVC|MyModule
My DNN manifest is as follows:
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Onboarding" type="Module" version="00.00.05">
<friendlyName>Onboarding</friendlyName>
<description>Onboarding</description>
<iconFile>~/Icons/Sigma/Software_32X32_Standard.png</iconFile>
<owner>
<name>example.com</name>
<organization>example.com</organization>
<url>https://example.com/</url>
<email>info#example.com</email>
</owner>
<license src="License.txt"></license>
<releaseNotes src="ReleaseNotes.txt"></releaseNotes>
<dependencies>
<dependency type="CoreVersion">08.00.00</dependency>
</dependencies>
<components>
<component type="Script">
<scripts>
<basePath>DesktopModules\MVC\MyModule</basePath>
<script type="Install">
<path>Providers\DataProviders\SqlDataProvider</path>
<name>00.00.01.SqlDataProvider</name>
<version>00.00.01</version>
</script>
<script type="UnInstall">
<path>Providers\DataProviders\SqlDataProvider</path>
<name>Uninstall.SqlDataProvider</name>
<version>00.00.01</version>
</script>
</scripts>
</component>
<component type="ResourceFile">
<resourceFiles>
<basePath>DesktopModules/MVC/MyModule</basePath>
<resourceFile>
<name>Resources.zip</name>
</resourceFile>
</resourceFiles>
</component>
<component type="Module">
<desktopModule>
<moduleName>Onboarding</moduleName>
<foldername>Onboarding</foldername>
<businessControllerClass>MySite.Modules.Onboarding.Components.FeatureController</businessControllerClass>
<supportedFeatures />
<moduleDefinitions>
<moduleDefinition>
<friendlyName>Onboarding</friendlyName>
<defaultCacheTime>0</defaultCacheTime>
<moduleControls>
<moduleControl>
<controlKey />
<controlSrc>Example.Modules.Onboarding.Controllers/Onboarding/Index.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle />
<controlType>View</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>
<moduleControl>
<controlKey>Edit</controlKey>
<controlSrc>Example.Modules.Onboarding.Controllers/Onboarding/Edit.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>Edit Onboarding Records</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
<supportsPopUps>True</supportsPopUps>
</moduleControl>
<moduleControl>
<controlKey>Settings</controlKey>
<controlSrc>Example.Modules.Onboarding.Controllers/Settings/Settings.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>Onboarding Settings</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>
</moduleControls>
</moduleDefinition>
</moduleDefinitions>
</desktopModule>
</component>
<component type="Assembly">
<assemblies>
<assembly>
<name>Onboarding.dll</name>
<path>bin</path>
</assembly>
<assembly>
<name>RestSharp.dll</name>
<path>bin</path>
</assembly>
<assembly>
<name>EntityFramework.dll</name>
<path>bin</path>
</assembly>
<assembly>
<name>EntityFramework.SqlServer.dll</name>
<path>bin</path>
</assembly>
<assembly>
<name>Newtonsoft.Json.dll</name>
<path>bin</path>
</assembly>
</assemblies>
</component>
</components>
</package>
The module won't install despite ensuring that all assemblies are in the bin folder under dnndev.me.
What must I do to rectify this issue?
If you built your MVC module using the Chris Hammond template, you will have the msbuild process for packaging the module that is driven by the file: BuildScripts/ModulePackage.targets
In that file, there is a line of code:
<Copy SourceFiles="$(MSBuildDnnBinPath)\$(AssemblyName).dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>
That is responsible for picking up the module's assembly in your local install's bin folder and copying it to the package folder that gets zipped. There is no automated step for including other custom dlls in there. This line occurs twice: once for the 'source' package and the other for the 'install' package.
Most of the time, I will just update this script to include my dependencies. Example:
<Copy SourceFiles="$(MSBuildDnnBinPath)\$(AssemblyName).dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>
<Copy SourceFiles="$(MSBuildDnnBinPath)\Onboarding.dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>
This isn't the most elegant solution as you need to hardcode your dependencies in the build script. But it works for simple modules. If you know a little about msbuild, you could use a copy step that includes all dlls in a folder and move your dependencies to a single folder and include all of them from the folder.
The way you do it means that the assemblies are included in your install package. To test if the assembies are installed (in the bin folder), you need to add a dependency, but there is no dependency to an assembly containing a version number or something alike. The trick is to add a dependency to a type defined in the assembly, e.g.
<dependency type="Type">DocumentFormat.OpenXml.Extensions.WorksheetWriter</dependency>
AFAIR it is important that the value of the type attribute is case-sensitive, so it has to be "Type", and not "type" or "TYPE".

Execute Obfuscar Before Fody.Costura Merge Files

How can I Execute Obfuscar Before Fody.Costura Merge the Files Because Merged Files Are not obfuscated, using Fody.Costura compression or wihout it.
I've downloaded https://github.com/obfuscar/example.git project example for obfuscar, then I've installed Fody and Fody.Costura by nuget, But output example is not obfuscated if i check it with ILSpy project.
https://github.com/icsharpcode/ILSpy (ILSpy project to download compressed files and see dll code)
https://github.com/G4224T/Fody-Costura-Decompress (To decompress fody costura files).
My obfuscar configuration is
<?xml version='1.0'?>
<Obfuscator>
<Var name="InPath" value="." />
<Var name="OutPath" value=".\Obfuscator_Output" />
<Var name="HidePrivateApi" value="true" />
<Var name="KeepPublicApi" value="false" />
<Var name="KeyFile" value=".\test.snk" />
<Module file="$(InPath)\BasicExampleExe.exe" />
<!--<Module file="$(InPath)\BasicExampleLibrary.dll" />-->
</Obfuscator>
And in fody costura I've tried with
<Costura DisableCompression="true" />
and
<Costura DisableCompression="false" />
I want any option for obfuscate and merge files using this projects because are free, Thanks all
I've found a workarround of this, and was to make a new form project in solution that reference the ofuscated dlls and exe, then in this new project install fody.costura nuget package, after it you need to change some configuration and code:
obsfucar.xml
<Obfuscator>
<Var name="InPath" value="." />
<Var name="OutPath" value=".\Obfuscator_Output" />
<Var name="HidePrivateApi" value="true" />
<Var name="KeepPublicApi" value="false" />
<Var name="KeyFile" value=".\test.snk" />
<Module file="$(InPath)\BasicExampleExe.exe">
<!-- You need to ommit afuscate startup form to call it from new project with fody.costura -->
<SkipType name="BasicExampleExe.ExampleUI" />
</Module>
<Module file="$(InPath)\BasicExampleLibrary.dll" />
</Obfuscator>
Then in the Program class of the new project with fody.costura
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ObfuscatorBeforeFodyCostura
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new BasicExampleExe.ExampleUI());//Edit this part with the ofuscated form.
}
}
}
Here the solution project edited:
git clone https://juandrn#bitbucket.org/juandrn/obfuscatorbeforefodycostura.git
Thanks!

Problems while using ANT for creating HTML (junit style) report

I am trying to generate an HTML/Junit Style report for the jMeter tests by using ANT. I have created a build file for this and have done all the pre-requisites like:
set the required variables like java home, ant home, path variables; put the ant build file and the required .jmx file (for jmeter execution) in a folder and calling "ant" command pointing at the same folder.
I tried calling the ant build file by giving commands as ant and ant -Dtest="Sample Workload Script".
The issue i get is that when i run this commands it reaches to the point of executing the test plan and then gives a java platform error (as shown in attached image) and stops the build. Any pointers to what might be causing this?
Java Platform Error when running the ANT Build file
I read somewhere that the ANT version may not be compatible with java 1.8. Speaking of which i am using Ant 1.9.7 and java 1.8.73
My build file:
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="ant-jmeter" default="all">
<description>
Sample build file for use with ant-jmeter.jar
See http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
To run a test and create the output report:
ant -Dtest=script
To run a test only:
ant -Dtest=script run
To run report on existing test output
ant -Dtest=script report
The "script" parameter is the name of the script without the .jmx suffix.
Additional options:
-Dshow-data=y - include response data in Failure Details
-Dtestpath=xyz - path to test file(s) (default user.dir).
N.B. Ant interprets relative paths against the build file
-Djmeter.home=.. - path to JMeter home directory (defaults to parent of this build file)
-Dreport.title="My Report" - title for html report (default is 'Load Test Results')
Deprecated:
-Dformat=2.0 - use version 2.0 JTL files rather than 2.1
</description>
<property name="testpath" value="${user.dir}"/> <!--<property name="testpath" value="${user.dir}"/>-->
<property name="jmeter.home" value="C:\apache-jmeter-3.0"/>
<property name="report.title" value="Load Test Results"/>
<!-- Name of test (without .jmx) -->
<property name="test" value="Test"/>
<!-- Should report include response data for failures? -->
<property name="show-data" value="n"/>
<property name="format" value="2.1"/>
<condition property="style_version" value="">
<equals arg1="${format}" arg2="2.0"/>
</condition>
<condition property="style_version" value="_21">
<equals arg1="${format}" arg2="2.1"/>
</condition>
<condition property="funcMode">
<equals arg1="${show-data}" arg2="y"/>
</condition>
<condition property="funcMode" value="false">
<not>
<equals arg1="${show-data}" arg2="y"/>
</not>
</condition>
<!-- Allow jar to be picked up locally -->
<path id="jmeter.classpath">
<fileset dir="${basedir}">
<include name="ant-jmeter*.jar"/>
</fileset>
</path>
<taskdef
name="jmeter"
classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
<!--classpathref="jmeter.classpath"-->
<!--classpathref="C:\apache-jmeter-3.0\extras"-->
<target name="all" depends="run,report"/>
<target name="run">
<echo>funcMode = ${funcMode}</echo>
<delete file="${testpath}/${test}.html"/>
<jmeter
jmeterhome="${jmeter.home}"
testplan ="${basedir}/${test}.jmx"
resultlog="${basedir}/${test}.jtl">
<!--
<jvmarg value="-Xincgc"/>
<jvmarg value="-Xmx128m"/>
<jvmarg value="-Dproperty=value"/>
<jmeterarg value="-qextra.properties"/>
-->
<!-- Force suitable defaults -->
<property name="jmeter.save.saveservice.output_format" value="xml"/>
<property name="jmeter.save.saveservice.assertion_results" value="all"/>
<property name="jmeter.save.saveservice.bytes" value="true"/>
<property name="file_format.testlog" value="${format}"/>
<property name="jmeter.save.saveservice.response_data.on_error" value="${funcMode}"/>
</jmeter>
</target>
<property name="lib.dir" value="${jmeter.home}/lib"/>
<!-- Use xalan copy from JMeter lib directory to ensure consistent processing with Java 1.4+ -->
<path id="xslt.classpath">
<fileset dir="${lib.dir}" includes="xalan*.jar"/>
<fileset dir="${lib.dir}" includes="serializer*.jar"/>
</path>
<target name="report" depends="xslt-report,copy-images">
<echo>Report generated at ${report.datestamp}</echo>
</target>
<target name="xslt-report" depends="_message_xalan">
<tstamp><format property="report.datestamp" pattern="yyyy/MM/dd HH:mm"/></tstamp>
<xslt
classpathref="xslt.classpath"
force="true"
in="${basedir}/${test}.jtl"
out="${basedir}/${test}.html"
style="${basedir}/jmeter-results-detail-report${style_version}.xsl">
<param name="showData" expression="${show-data}"/>
<param name="titleReport" expression="${report.title}"/>
<param name="dateReport" expression="${report.datestamp}"/>
</xslt>
</target>
<!-- Copy report images if needed -->
<target name="copy-images" depends="verify-images" unless="samepath">
<copy file="${basedir}/expand.png" tofile="${testpath}/expand.png"/>
<copy file="${basedir}/collapse.png" tofile="${testpath}/collapse.png"/>
</target>
<target name="verify-images">
<condition property="samepath">
<equals arg1="${testpath}" arg2="${basedir}" />
</condition>
</target>
<!-- Check that the xalan libraries are present -->
<condition property="xalan.present">
<and>
<!-- No need to check all jars; just check a few -->
<available classpathref="xslt.classpath" classname="org.apache.xalan.processor.TransformerFactoryImpl"/>
<available classpathref="xslt.classpath" classname="org.apache.xml.serializer.ExtendedContentHandler"/>
</and>
</condition>
<target name="_message_xalan" unless="xalan.present">
<echo>Cannot find all xalan and/or serialiser jars</echo>
<echo>The XSLT formatting may not work correctly.</echo>
<echo>Check you have xalan and serializer jars in ${lib.dir}</echo>
</target>
</project>
Update "jmeter" section of your build.xml file as follows:
<jmeter
jmeterhome="${jmeter.home}"
testplan ="${basedir}/${test}.jmx"
resultlog="${basedir}/${test}.jtl"
jmeterlogfile="${basedir}/jmeter.log"> <!-- add this line to enabled logging-->
Re-run your test and look into jmeter.log file under your C:\workspace\CPT folder - it should contain enough troubleshooting information so you will be able to find out the cause. If you have problems interpreting the log file - add it to your question.
References:
JMeter Ant Task
Five Ways To Launch a JMeter Test without Using the JMeter GUI

log4net log file not being written when the app is deployed

I have a WPF app that uses log4net. When I run it in Visual Studio, the log file is created in the Debug or Release folder as expected.
However, when I create an installer and run the installed app, the log file is not created. I added the following lines to the code...
string logFilePath = ((Hierarchy)LogManager.GetRepository())
.Root.Appenders.OfType<FileAppender>()
.FirstOrDefault()?.File;
using (StreamWriter sw = new StreamWriter(#"d:\log.log")) {
sw.WriteLine("Log file: " + logFilePath);
}
...to enable me to check that the log file was being written in the location I expected. It showed me that the log file was supposed to be written to C:\Program Files (x86)\Physio Diary\PhysioDiaryClient.log which is what I expected.
However, the file doesn't exist. Any idea why?
Here is the top of the App.config file...
<?xml version="1.0"
encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
</configSections>
<log4net>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<param name="File"
value="PhysioDiaryClient.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="2" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-7level %logger - %message%newline%exception" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
The bottom of the file looks like this...
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
The bits in between are all to do with the WCF services that the app uses.
Anyone any ideas?
Edit: As a test, I tried hard-coding the log file path in App.config to my D: drive (so it's hard-coded, and no question of a permissions issue), but the file still wasn't created.
Thanks to #dymanoid for pointing me in the right direction. The log4net docs are a bit weak in this area, but I found this answer that pointed out that you can use normal environment variables in the config file.
With the aid of this list of environment variables, I ended up with the following...
<param name="File"
value="${LOCALAPPDATA}\Physio Diary\PhysioDiaryClient.log" />
This correctly write the file to C:\Users\MyUsername\AppData\Local\Physio Diary\PhysioDiaryClient.log
Hope this helps someone.

Wix Burn select msi and apply mst dynamically

I have MSI's in english, german and a MST transform file for german installer.
Now in burn boostrapper how to bundle these MSI's and MST's so that appropriate localized MST is applied to the msi during runtime ?
<Bundle ....>
<Chain>
<PackageGroupRef Id='Netfx4Full' />
<PackageGroupRef Id='SQLServerCompact4.0' />
<MsiPackage Id="EN_MSI_x86"
SourceFile="$(var.MsiDir_x86)MyApp_x86.msi"
Compressed="yes" EnableFeatureSelection="no" Vital="yes" Visible="no"
InstallCondition="NOT VersionNT64">
<MsiProperty Name="INSTALL_LANG" Value="1033" />
<MsiProperty Name="TRANSFORMS" Value="[SystemLanguageID].mst"/>
<Payload Id="1031.mst" Compressed="yes" Name="de-localization" SourceFile="$(var.MsiDir_x86)1031.mst" />
</MsiPackage>
</Chain>
</Bundle>
Is this the right way to include MST in the bundle ?
I guess the error is in the payload attributes. If you swap the values of Id an Name it should work. The msi installer looks for a file named 1031.mst but you named it de-localization.

Resources