I am trying to use PreEmptive Solutions - Dotfuscator with my Xamarin.IOS app, but the build fails and I am getting this error:
I have done all the steps from here:
https://www.preemptive.com/obfuscating-xamarin-with-dotfuscator
My Xamarin.Android works fine, but the IOS project fails.
The error:
The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition\dotfuscatorCLI.exe" /p:InDir="obj\iPhone\Release\DotfuscatorXamarin\dfin",OutDir="obj\iPhone\Release\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\iPhone\Release" "DotfuscatorConfig.xml"" exited with code 1.
Any idea how I can fix it?
Update 29-06-2017:
Content of DotfuscatorConfig.xml file for the Xamarin.IOS project
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
<propertylist>
<property name="InDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfin" />
<property name="OutDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfout" />
<property name="ReportDir" value="DotfuscatorReports\iPhone\Release" />
</propertylist>
<global>
<option>monocompat</option>
</global>
<input>
<asmlist>
<inputassembly refid="7cf160e1-e28e-4f81-bd8d-f10fdcbcc3f8">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll" />
</inputassembly>
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
<inputassembly refid="11652964-9a02-4f24-b042-25f260fada88">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.iOS.exe" />
</inputassembly>
</asmlist>
</input>
<output>
<file dir="${configdir}\${OutDir}" />
</output>
<renaming>
<option>xmlserialization</option>
<mapping>
<mapoutput overwrite="true">
<file dir="${configdir}\${ReportDir}" name="Renaming.xml" />
</mapoutput>
</mapping>
<referencerulelist>
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
</referencerulelist>
</renaming>
<sos mergeruntime="true">
<option>version:v4</option>
<option>disable</option>
<option>dontsendtamper</option>
</sos>
<smartobfuscation>
<smartobfuscationreport verbosity="all" overwrite="true">
<file dir="${configdir}\${ReportDir}" name="SmartObfuscation.xml" />
</smartobfuscationreport>
</smartobfuscation>
</dotfuscator>
And for PreEmptive.Dotfuscator.Xamarin.targets file, I am using the one from the offical website.
PreEmptive.Dotfuscator.Xamarin.targets
As mentioned in the comments to the question, I work for PreEmptive Solutions.
This is a bug in the Dotfuscator-Xamarin targets file (PreEmptive.Dotfuscator.Xamarin.targets), so sorry about that.
Note: This issue has been corrected in version 1.1.0 of the targets file. The latest version of the file can be downloaded on this page.
Specifically, when generating the initial Dotfuscator config file (DotfuscatorConfig.xml), we were treating an MDB (Mono debug symbol) file as an input assembly.
The next version of the targets file will correct this issue.
To resolve this issue with version 1.0.0 of the targets file, please delete the following lines from DotfuscatorConfig.xml:
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
The targets file will use your corrected version from then on.
Related
I am able to successfully build and run my app in ios5, but when I upgrade to ios6.1.0 in order to install a plugin that will allow me to use VKwebview and reference local html files, I get 3 fatal errors in xcode:
Property 'userAgent' not found on object of type 'CDVViewController *'
Use of undeclared identifier 'CDVUserAgentUtil'. (these are repeated twice)
I am at a total loss as to even start looking for the answers.
This is my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.slate.v2" version="1.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>ACCELERATE RMS</name>
<description>
M-learning accelerated.
</description>
<author email="support#phonegap.com" href="http://phonegap.com">
Cnnect
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<icon density="mdpi" height="57" platform="ios" src="icon.png" width="57" />
<config-file overwrite="true" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>Allow the app to use your camera to take your profile picture.</string>
</config-file>
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<platform name="ios">
<preference name="Orientation" value="all" />
</platform>
<engine name="browser" spec="^5.0.4" />
<plugin name="phonegap-plugin-contentsync" spec="~1.4.2" />
<plugin name="cordova-plugin-camera" spec="~4.0.3" />
<plugin name="cordova-plugin-geolocation" spec="~4.0.1" />
<plugin name="cordova-plugin-file" spec="~6.0.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
<plugin name="cordova-plugin-dialogs" spec="~2.0.1" />
<plugin name="cordova-plugin-local-notification" spec="~0.9.0-beta.3">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="26.+" />
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="~8.0.1" />
<plugin name="onesignal-cordova-plugin" spec="~2.8.1" />
<plugin name="cordova-plugin-file-transfer" spec="~1.7.1" />
<plugin name="cordova-plugin-wkwebview-engine" spec="^1.2.1" />
<plugin name="cordova-plugin-wkwebviewxhrfix" spec="~0.1.0" />
</widget>
CDVUserAgentUtil has been removed in cordova-ios#6 which is a breaking change (hence the major version increment in cordova-ios to 6).
This class is used by some Cordova plugins in your project hence the error.
You should first update all of your plugins to the latest versions so those which have been updated to removed references to CDVUserAgentUtil are used.
At least one of your plugins - cordova-plugin-file-transfer is deprecated and contains an implicit reference to CDVUserAgentUtil. In this case you could use my fork of this plugin which has been fixed to remove the reference:
cordova plugin rm cordova-plugin-file-transfer && cordova plugin add https://github.com/dpa99c/cordova-plugin-file-transfer
It may be that other plugins in your project still contain references to CDVUserAgentUtil after updating all your plugins.
If this is the case, you should search them for references:
grep -r -l 'CDVUserAgentUtil' plugins/
If you find any references and no plugin upates are available, you could:
raise an issue against the plugin asking for it to be updated
look for a fork of the plugin that has already been updated
fork the plugin and fix it yourself
If the build still fails after updating all your plugins to remove the references, there may be more implicit references such as that in cordova-plugin-file-transfer so you'll need to search for and resolve those:
grep -r -l 'userAgent' plugins/
The cordova-plugin-wkwebview-engine is deprecated in Cordova iOS#6.x for more details see, from Cordova iOS#6.x onwards it by defaults supports WKWebView not UIWebView. So, you need to remove the Cordova plugin from your project.
cordova plugin rm cordova-plugin-wkwebview-engine
Note : Please backup your project before doing any change for your safety.
For ionic v5 users
I have fixed this by upgrading cordova-plugin-ionic-webview to 4.2.1
hopping this help
So I migrated from nuget packages.config to PackageReference and found out there were some compatibility issues. I reverted the project to its working state (before the PackageReference) and now my project is not compiling.
I get the following error:
Severity Code Description Project File Line Suppression State
Error The package EntityFramework with version 6.2.0 could not be found in C:\Users\user.nuget\packages. Run a NuGet package restore to download the package. DbManager
This happened to multiple packages. It seems that Nuget is searching for packages in the user.net\package directory for some reason. Originally, there was a folder within the project that contained all the packages.
I forced the global path to be at the folder within the project by editing the NuGet.Config file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="C:\Projects\App\App Source\packages\" />
<add key="globalPackagesFolder" value="C:\Projects\App\App Source\packages\" />
</config>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
</configuration>
I don't know why Nuget keeps looking for packages at that location. It should be looking at the packages folder within the project.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net46" />
<package id="EntityFramework6.Npgsql" version="3.1.1" targetFramework="net46" />
<package id="Npgsql" version="3.2.7" targetFramework="net46" />
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net46" />
<package id="Z.EntityFramework.Plus.EF6" version="1.7.17" targetFramework="net46" />
</packages>
All of these packages in packages.config are not being found. This problem started happening when I tried PackageReference.
Is there any way to reset Nuget's settings? I would appreciate any guidance in solving this problem.
TLDR; This is caused by latent copies of the new project.assets.json file being left in your /obj/ folders. These can be safely deleted.
You can run this Powershell (at your own risk) in your root solution folder as a quick way to purge these files:
ls project.assets.json -Recurse | foreach {rm $_}
project.assets.json is generated for projects using PackageReference to cache the Nuget dependency graph for your project. It seems to confuse Visual Studio/Nuget if it's left there even if your project is using (or reverted back to using) packages.config
This can happen in Visual Studio 2019 as well, if you try PackageReference and then revert back to packages.config (or even if you switch between Git branches with one Nuget restore method versus the other).
Further Info
More info on project.assets.json here:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build?tabs=netcore2x
1) I finally managed to get something compiled through Google Closure Compiler using Ant to automate the process. The problem im facing, is that all the examples provided concatenate the output into one main file (main example I followed), say foo.min.js. What I need is to minify/compile ALL the .js files in one and/or more directories into their respective .min.js files, without concatenating the output, so, lets say, I have 3 .js files, I need 3 minified .min.js outputs.
Here's my (first) current build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="foobar" basedir="." default="compile">
<property environment="env."/>
<property name="env.CLASSPATH" value=""/>
<fail message="Unset $CLASSPATH / %CLASSPATH% before running Ant!">
<condition>
<not>
<equals arg1="${env.CLASSPATH}" arg2=""/>
</not>
</condition>
</fail>
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${env.CLOSURE_COMPILER}/compiler.jar" />
<target name="compile">
<jscomp compilationLevel="simple" warning="quiet" debug="false" output="${basedir}/admin/js/foo.min.js">
<sources dir="${basedir}/admin/js">
<file name="home.js" />
<file name="mailing.js" />
<file name="table_modal_events.js" />
</sources>
</jscomp>
</target>
</project>
2) Following Ant's installation manual, I've added this
<property environment="env."/>
<property name="env.CLASSPATH" value=""/>
<fail message="Unset $CLASSPATH / %CLASSPATH% before running Ant!">
<condition>
<not>
<equals arg1="${env.CLASSPATH}" arg2=""/>
</not>
</condition>
</fail>
to the top of my project, and after building successfully multiple times this way, I noticed that if I remove <property environment="env."/> I get a taskdef class com.google.javascript.jscomp.ant.CompileTask cannot be found
using the classloader AntClassLoader[] error. May I ask why? (being %CLOSURE_COMPILER% an environment variable which I also added to PATH) This answer may be related to this? But I still don't understand.
3) This is the closest related question/answer I could find. But it makes use of a bash script, so my question is: is it possible to achieve what I want using Ant?
I would appreciate if somebody could tell me what I'm doing wrong.
You just need something like into your target
<apply executable="java" parallel="false">
<fileset dir="webapp/js" includes="**/*.js"
excludes="any to exclude" />
<arg line="-jar"/>
<arg path="PATH/closure-compiler-XXX.jar"/>
<arg line="--js "/>
<srcfile/>
<arg line="--warning_level=QUIET" />
<arg line="--js_output_file"/>
<mapper type="glob" from="*.js" to="build/webapp/js/*.js"/>
<targetfile/>
</apply>
I'm trying to create bootstrapper package for Visual Studio 2010. It has appeared in prerequisites window. Here is my product.xml
<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="FaroLS" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="true">
<PackageFile Name="faro ls 5.2.0.35213 x64 setup.exe" />
<PackageFile Name="example.faro.ls.exe.manifest" />
<PackageFile Name="faro.ls_5.2.0.35213.msi" />
<PackageFile Name="farolsdemoscans.zip" />
<PackageFile Name="faroopendemoapp.zip" />
<PackageFile Name="farosdkdemoapp.zip" />
<PackageFile Name="unins000.dat" />
<PackageFile Name="unins000.exe" />
<PackageFile Name="vcredist_x64.exe" />
<PackageFile Name="vcredist_x64_90.exe" />
</PackageFiles>
<InstallChecks>
<RegistryCheck Property="IsInstalled" Key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FARO LS_is1\" Value="Inno Setup: Setup Version"/>
</InstallChecks>
<Commands Reboot="Defer">
<Command PackageFile="faro ls 5.2.0.35213 x64 setup.exe">
<InstallConditions>
<BypassIf Property="IsInstalled" Compare="VersionGreaterThanOrEqualTo" Value="5.1.6" />
</InstallConditions>
<ExitCodes>
<DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
File example.faro.ls.exe.manifest
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='FARO.LS' version='1.1.502.0' processorArchitecture='amd64' publicKeyToken="1d23f5635ba800ab"/>
</dependentAssembly>
</dependency>
</assembly>
To determine whether i have already installed this product i'm checking registry entry
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FARO LS_is1\Inno Setup: Setup Version
And now the bad things. Registry check does not work. Every time i launch product setup it asks me to install additional component, even if it is already installed.
And when installation starts i get error:
Setup has detected that the file 'C:\Users\user\AppData\Local\Temp\VSD1F0C.tmp\FaroLS\faro ls 5.2.0.35213 x64 setup.exe'
has either changed since it was initially published or may be corrupt.
See the setup log file located at
'C:\Users\user\AppData\Local\Temp\VSD1F0C.tmp\install.log' for more information.
I found some similar topics on stackoverflow, where .net 4.5 caused this problem. But i don't have one installed.
File faro ls 5.2.0.35213 x64 setup.exe does not have digital signature. Can it cause errors? Are there any ways to make it work?
Im using eclipse and maven for my day to day development, which works fine. However I need a specialized war created when its time to export to send over to production, which includes things like minifying and combining js/css etc, separating out static resources for apache rather than tomcat etc.
I tried the maven plugin route but it was a hassle, I'd rather write a simply ant script to export when necessary. I'm using the ant war task, but the exported war contains everything except my WEB-INF/libs folder, which is blank. Does anyone know a way to make the script work with all the libs that maven looks up? This is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="war" basedir=".">
<property name="builder" value="Me" />
<property name="project-name" value="${ant.project.name}" />
<property name="war-file-name" value="${project-name}.war" />
<property name="source-directory" value="src/main/java" />
<property name="classes-directory" value="target/classes" />
<property name="web-directory" value="src/main/webapp" />
<property name="web-xml-file" value="src/main/webapp/WEB-INF/web.xml" />
<property name="build-directory" value="/" />
<tstamp prefix="build-info">
<format property="current-date" pattern="d-MMMM-yyyy" locale="en" />
<format property="current-time" pattern="hh:mm:ss a z" locale="en" />
</tstamp>
<target name="war" depends="">
<mkdir dir="${build-directory}" />
<delete file="${build-directory}/${war-file-name}" />
<war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
<classes dir="${classes-directory}" />
<fileset dir="${web-directory}">
<exclude name="WEB-INF/web.xml" />
</fileset>
<manifest>
<attribute name="Built-By" value="${builder}" />
<attribute name="Built-On" value="${build-info.current-date}" />
<attribute name="Built-At" value="${build-info.current-time}" />
</manifest>
</war>
</target>
</project>
You can use maven ant tasks for this. I have not tried this, but from the examples, something like this should work...
<artifact:dependencies filesetId="dependency.fileset" useScope="runtime">
<pom file="pom.xml"/>
</artifact:dependencies>
<copy todir="${webapp.output}/WEB-INF/lib">
<fileset refid="dependency.fileset" />
<!-- This mapper strips off all leading directory information -->
<mapper type="flatten" />
</copy>