Stopping the build Xamarin Android project while dotfuscator run - obfuscation

I try to integrate Dotfuscator in my Xamarin Project according this manual : https://www.preemptive.com/dotfuscator/ce/docs/help/getting_started_xamarin.html
I executed steps : Import the Targets File and Set MSBuild Properties and I skipped Add Dotfuscator Config File to Project because I have not config as yet. Then I launch building and got this error :
There are no assemblies to process. Stopping the build...
Looks like dotfuscator required .dll assemblies but I don't have these, because building is not completed, because dotfuscator is stoping.
UPD
I Edited Android.csproj file like this :
1) added
< DotfuscatorXamarinEnabled >true< /DotfuscatorXamarinEnabled >
2) added this Code
< PropertyGroup >
< DotfuscatorXamarinConfigFileName >DotfuscatorConfig.xml< /DotfuscatorXamarinConfigFileName >
< DotfuscatorXamarinCliPath>C:\Program Files (x86)\PreEmptive Solutions\Dotfuscator Professional Edition Evaluation4.43.1\dotfuscator.exe< /DotfuscatorXamarinCliPath >
< DotfuscatorXamarinGenerateNewConfigFile >true< /DotfuscatorXamarinGenerateNewConfigFile>
< DotfuscatorIncludeAsInput >< /DotfuscatorIncludeAsInput>
< /PropertyGroup>
< Import Project="..\..\PreEmptive.Dotfuscator.Xamarin\PreEmptive.Dotfuscator.Xamarin.targets"/>
before < /Project> tag.
and still have the error : There are no assemblies to process. Stopping the build...
UPD2
I tried to change .csproj file exactly like at this link :: https://www.preemptive.com/dotfuscator/pro/userguide/en/getting_started_protect.html#integrate-xamarin
this time obfuscation not even started. Application was builded, but it was simple apk, as usually.

Your link is to the Dotfuscator Community (CE) user guide, but your screenshot shows you are using Dotfuscator Professional. Instead, see the Xamarin page in the Dotfuscator Professional user guide.
(Note: I work on the Dotfuscator team.)

Related

MSB4062 error publishing .NET7 app with publish profile

This is pretty easy to replicate but also code here:
https://github.com/dominicshaw/dotnet-publish-error
create an empty wpf project using .NET7
create a publish profile for ClickOnce
publish via command line (not visual studio)
Publish profile is almost totally standard (view here)
Command line from project directory:
dotnet publish PublishError.csproj -p:PublishProfile=ClickOnceProfile
Subsequent error:
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.100\Microsoft.Common.CurrentVersion.targets(4149,5): error MSB4062: The "Microsoft.Build.Tasks.RequiresFr
amework35SP1Assembly" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKey
Token=b03f5f7f11d50a3a. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, a
nd that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\shawd\source\repos\PublishError\Publi
shError\PublishError.csproj]
I have the latest SDKs installed and VS2022 up to date. This only happens via command line - I am able to publish from Visual Studio (I am setting up devops, so require command line).
This happens regardless of adding nuget package for Microsoft.Build.Tasks.Core. Note however nuget package v15.1.0.0 is not available - I have tried 15.1.548 and the latest instead.
Totally at a loss! Any ideas very welcome.
Thanks vm
During the tests with your project and files, I finally managed to publish it successfully with the command dotnet publish PublishError.csproj -p:PublishProfile=FolderProfile.
Here is the document for dotnet publish, as is referred,
The preceding example uses the FolderProfile.pubxml file that is found
in the <project_folder>/Properties/PublishProfiles folder. If you
specify a path and file extension when setting the PublishProfile
property, they are ignored. MSBuild by default looks in the
Properties/PublishProfiles folder and assumes the pubxml file
extension.
And I also succeeded with dotnet publish with your project.
==============================
update on 11/19
So I suppose that the issue is resulted from your definition for -p:PublishProfile=ClickOnceProfile,it will change the path where this command would search for the publish file
A partial answer as my workaround for anyone struggling with a similar problem:
I have found it impossible to do this with the dotnet cli but I can do it with MSBuild if I specifically target 17.4 (VS2022). By default, my Azure DevOps Server 2020 capability is the 2019 MSBuild (15.X), so I have to be explicit:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" /restore /Verbosity:m /t:Publish /p:RuntimeIdentifier=win-x64 /p:configuration=Release /p:PublishProfile=ClickOnceProfile
This works - so in my pipeline I have created a batch file which runs this, then I copy the files to my ClickOnce location.
Not ideal, but a working pipeline.
Interesting side note - this dotnet cli command which should be idenitical (and indeed uses the correct 17.4 MSBuild) - does not work (with the same error):
dotnet msbuild -target:Publish -property:RuntimeIdentifiers=win-x64;Configuration=Release;PublishProfile=ClickOnceProfile

Can Fody and its plugins be used with .NET Core (3.0)?

As the title says, I'm having trouble getting Fody, and the plugin Fody.PropertyChanged, to work in .NET Core 3.0, or any .NET Core version. Reading the issues on the respective GitHub pages doesn't answer my question, nor am I able to find any relevant answers.
Once installed I cannot run my WPF project anymore and I am given the following error:
The target process exited without raising a CoreCLR started event.
Ensure that the target process is configured to use .NET Core.
This may be expected if the target process did not run on .NET Core.
The program '[21820] CalculationToolsApp.exe' has exited with code -2147450749 (0x80008083).
Any suggestions?
EDIT: I found out that I (maybe) cant use "Fody.Costura" with "Fody.PropertyChanged" like this in the FodyWeavers.xml file:
<Weavers>
<PropertyChanged />
<Costura />
</Weavers>
Which shouldn't be a problem because with .NET Core I can create a single file application anyway. Removing the Costura reference from the FodyWeavers.xml solved my problem!
It should work. Fody is compatible with .NET Standard.
Create a new WPF app using the WPF App (.NET Core) template in Visual Studio 2019 or using the dotnet new wpf command
Install the Fody and PropertyChanged.Fody NuGet packages
Add a file named "FodyWeavers.xml" with the following contents to the project:
<Weavers>
<PropertyChanged />
</Weavers>
Build
If you then decompile the assembly using a decompiler such as for example dotPeek, you should see the injected code as expected, e.g.:
public string GivenNames
{
// Method get_GivenNames with token 06000009
get
{
return this.<GivenNames>k__BackingField;
}
// Method set_GivenNames with token 0600000A
set
{
if (string.Equals(this.<GivenNames>k__BackingField, value, StringComparison.Ordinal))
return;
this.<GivenNames>k__BackingField = value;
this.<>OnPropertyChanged(<>PropertyChangedEventArgs.FullName);
this.<>OnPropertyChanged(<>PropertyChangedEventArgs.GivenNames);
}
}
Costura didnt work in wpf with .net core 3.1 for me either.
In .net core 3.1 you can use this instead:
Build -> publish -> create profile -> Edit "Configuration"
Target Runtime = win-x64 (or what ever target system you want, but NOT "portable")
expand "File Publish Options"
check: Produce single file
save
When you now choose build -> publish -> publish button it will create the single file.
It seems to be that they stopped the costura project because of the "Single-file executables" feature of .net core. Though this feature is still behind costura because you have to set a target runtime.
https://github.com/Fody/Costura/issues/442
In dotnet core 3 there are two new features
Single-file executables
Assembly linking
With these features included in the dotnet tool set, the value
proposition of Costura is greatly diminished. With that in mind I
think long term Costura should cease to be used as people transition
over.
Please comment with any input.
Plan:
disable issues
PR will still be accepted but only for bug fixes
add note to readme
add note to nuget description
write a warning in
update for .NET 5:
for .NET 5 and the current visual studio version 16.10.2 the wizard changed. I could not get this to work with the wizard anymore though i checked the options for single file etc.. But using the console worked: tools -> command line -> developer command prompt -> enter this:
dotnet publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true
.NET 5 not compiling to single file executables

how to Step through Catel code while debugging ?

After adding Catel implementation to one of my views(mainPage) in my project I have a bug that crashes my Silverlight project. The only indication I have is :" A first chance exception of type 'System.NullReferenceException' occurred in Catel.MVVM " (just about after setting the RootVisual~) - I can't find what I'm doing wrong, and since I am planing on a long-term relationship with Catel I thought that stepping through Catel code might come in handy, so I tried and failed in all the following steps (any help will be appreciated.. because currently I'm stuck and can't find anything):
downloaded catel 3.9 source files (same as my nuget package) and tried building it.. failed with this error :
E:\Dev\Catel-3.9.0\src\Catel.Core\Catel.Core.SL5\Fody.targets(51,5): error MSB4036: The "Fody.WeavingTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "E:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" directory. - trying to search and figure the reasons and overcome this, lead me to nowhere. :(
i have followed this "Stepping through the code" instruction in Catel documentation but noting really happened (I'm using VS2010..is this an issue ?? )
I read this article & readme.md at : https://github.com/GeertvanHorrik/GitHubLink about using GitHubLink to help you stepping through Catel code while debugging. I downloaded the release GitHubLink 1.3.0 from https://github.com/GeertvanHorrik/GitHubLink/releases/tag/1.3.0 ... but running this even with just the githublink.exe -help flag had thrown a exception..
I downloaded the Githublink-master source files but 0 projects were loaded (the GithubLink project file is incompatible with the current version of VS - I'm using VS2010)
can anyone help me either shade some light or:
overcome the build error I receive for catel (no.1)
instruct me how to set & step into catel ?
share the pdb files for Catel libs
It completely depends on the version you are using. If you are using the latest official one (3.9), stepping through the code is only possible by cloning the master branch and building the PDB files yourself.
In the latest prerelease versions via NuGet (the upcoming 4.0 version) you only have to enable the source server checkbox.
Note that you should never have to use GitHubLink yourself, that is for developers only (we run it during the build of Catel).
About the Fody task: it looks like the NuGet packages have not yet been restored on your side. In the lib folder there is a RestorePackages.bat which you can run to restore the packages.
I tried debugging on VS2012 and using Catel 4 pre-release (from Nuget)..
although I believe I did all the right things & settings in VS, I didnt get much further..
So I Opened (using a bin editor) the pdb file that was pulled by Nuget with the DLL, and took a look at the bin file.
the file have strings pointing to the source files at this directory :
C:\ci_ws\WS\1629\source\catel\src\catel/mvvm\catel.mvvm.shared..
So I have created a tree that starts with
c:\ci_ws\ws\1629\source
and downloaded the catel folder to that dir, renamed it from
"Catel-Develop" to just "Catel" in order to feet the location the pdb pointed.
To get things going I also had to add a "Symbol File(.pdb) location" in VS
option-> settings->Debugging->Symbols..(location/server list) to where the nuget download the packages.
in my case.. SolutionFolder\Packages\Catel.MVVM.3.9.0.1406062245-beta\lib\sl50..(I'm using Silverlight)
and then I was able to load the symbols and step/break into the code successfully ..
Maybe I missing something and there is a better way, but this the only way that worked for me..
The only question that still remains for me now is : What is the name of the Catel Github source branch that is matching the pre-release dll and pdb that Nuget is publishing at the moment (3.9.0.1406062245) ?
(I unchecked the general debug settings of : require source files to exactly match the original version)

I get this Missing or bad plugin while running sonar-runner on a C project

I'm trying to analyze a example project which was provided by the sonarQube examples. I have this C/C++ version 2.0 plugin installed on my SonarQube.
My sonar-project.properties has these contents.
sonar-project.properties
sonar.projectKey=org.codehaus.sonar:simple-c-project
sonar.projectName=Simple C project analyzed with the SonarQube Runner
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=c
sonar.sourceEncoding=UTF-8
When i run the sonar-runner command for this project i get an error as given below
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:41)
Caused by: com.A.A.A.B.A: Missing or bad plugin license. Please check logs.
Am i missing any plugins or is the plugin installed not proper.
Thank You.
Alternatively you can use another plugin in sonar called sonar-cxx if you don't want to use the commercial plugin. Its community edition Plugin. You can find it Here- https://github.com/wenns/sonar-cxx/wiki/Installation
You can download it from here - https://github.com/wenns/sonar-cxx/releases/tag/cxx-0.9.1
The C/C++ plugin is a commercial plugin, which requires a purchased licenses. I suspect the problem is that it can't find your licenses.
According to the official instructions, you need to do this:
Log in as a System administrator, go to Settings > General Settings > Licenses, paste your license key and Save (was Settings > General Settings > C/C++ (SonarSource) prior to version 1.6).

no install folder after building VB.Net DAL2 Compiled Module

I have a dnn 7 website set up locally for development through dnndev.me. However I did not install the dnndev.me in the standard root folder c:\websites\dnndev.me\ it is in another location in my user documents. But the dnn installation works fine. So I added the dotnetnuke project templates and created a new project following the instructions on this page:
http://www.chrishammond.com/blog/itemid/2616/using-the-new-module-development-templates-for-dot.aspx
When I build the module in debug and then release it says build successful and there are no errors, however there is no install folder and no installation files.
Dose some one have an idea of how I can trouble shoot this?
Thanks in advance.
EDIT 1:
I have user both the C# and VB tempates as well as the Da2l and non-Dal2 templates. Same problem with every template.
Also,
I tried updating the MsBuildCommunity to the current version, that did not solve the problem either.
And i tried reinstallin ghte msbuild from the project manager command line - i got an error and did not solve the problem.
EDIT 2
So I am using version 2.5 of the templates. It appears that part of the build is working correctly because there are files generated and copied/created in the dnndev.me\bin folder and the desktopmodlue\MODULENAME\obj\debug folder.
I tried to run the build from the visual studio command prompt, here is the command prompt output from a newly created and un altered vb template with Dal2:
C:\websites\dnndev.me\DesktopModules\DNNModule1>msbuild DNNModule1.vbproj
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34003]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/29/2013 11:34:58 PM.
Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModule1.vbproj" on
node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Vbc.exe /noconfig /imports:Micr
osoft.VisualBasic,System,System.Collections,System.Collections.Generic,System
.Data,System.Linq,System.Diagnostics,System.Collections.Specialized,System.Co
nfiguration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.
Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System
.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.W
eb.UI.HtmlControls /optioncompare:Binary /optionexplicit+ /optionstrict:custo
m /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /option
infer+ /nostdlib /rootnamespace:Christoc.Modules.DNNModule1 /sdkpath:"C:\Prog
ram Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
/highentropyva- /doc:obj\Debug\DNNModule1.xml /define:"CONFIG=\"Debug\",DEBUG
=-1,TRACE=-1,_MyType=\"Custom\",PLATFORM=\"AnyCPU\"" /reference:C:\websites\d
nndev.me\bin\DotNetNuke.dll,C:\websites\dnndev.me\bin\DotNetNuke.WebUtility.d
ll,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFrame
work\v4.0\System.Configuration.dll","C:\Program Files (x86)\Reference Assembl
ies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll","C:\Program Files
(x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Dat
a.DataSetExtensions.dll","C:\Program Files (x86)\Reference Assemblies\Microso
ft\Framework\.NETFramework\v4.0\System.Data.dll","C:\Program Files (x86)\Refe
rence Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll","C:\Progr
am Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Sy
stem.Drawing.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Fram
ework\.NETFramework\v4.0\System.EnterpriseServices.dll","C:\Program Files (x8
6)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll
","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew
ork\v4.0\System.Web.Extensions.dll","C:\Program Files (x86)\Reference Assembl
ies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Mobile.dll","C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Syst
em.Web.Services.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\F
ramework\.NETFramework\v4.0\System.Xml.dll" /debug+ /debug:full /out:obj\Debu
g\DNNModule1.dll /target:library Components\FeatureController.vb Components\I
temController.vb Components\Item.vb Settings.ascx.designer.vb Settings.ascx.v
b DNNModule1SettingsBase.vb Edit.ascx.designer.vb Edit.ascx.vb "My Project\As
semblyInfo.vb" DNNModule1ModuleBase.vb View.ascx.designer.vb View.ascx.vb "C:
\Users\Jordan\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttribute
s.vb"
vbc : warning BC40010: Possible problem detected while building assembly 'DNNMo
dule1': The version '00.00.01.*' specified for the 'file version' is not in the
normal 'major.minor.build.revision' format [C:\websites\dnndev.me\DesktopModul
es\DNNModule1\DNNModule1.vbproj]
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\DNNModule1.dll" to "..\..\bin\DNNModule1.dll".
DNNModule1 -> C:\websites\dnndev.me\bin\DNNModule1.dll
Copying file from "obj\Debug\DNNModule1.pdb" to "..\..\bin\DNNModule1.pdb".
Copying file from "obj\Debug\DNNModule1.xml" to "..\..\bin\DNNModule1.xml".
Done Building Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModul
e1.vbproj" (default targets).
Build succeeded.
"C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModule1.vbproj" (default ta
rget) (1) ->
(CoreCompile target) ->
vbc : warning BC40010: Possible problem detected while building assembly 'DNN
Module1': The version '00.00.01.*' specified for the 'file version' is not in t
he normal 'major.minor.build.revision' format [C:\websites\dnndev.me\DesktopMod
ules\DNNModule1\DNNModule1.vbproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.65
C:\websites\dnndev.me\DesktopModules\DNNModule1>
as for the MSBuild Community Tasks. I have the following folder in the packages directory:
MSBuildTasks.1.4.0.61. If I go to menu Tools -> Library Package Manager -> Manage NuGet Packages for Solution, the MsBuildTasks is listed in the installed packages (v 1.4.0.61).
EDIT 3
Okay, so i was thinking the same thing as chris in regards to the release vs debug setting. So i manually triggered a realease build using the command promt /p:configuration=release. THis caused a new error to appear:
C:\websites\dnndev.me\DesktopModules\DNNModule1>msbuild dnnmodule1.vbproj /p:Configuration=Release
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34003]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/30/2013 12:06:27 AM.
Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\dnnmodule1.vbproj" on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
dnnmodule1 -> C:\websites\dnndev.me\bin\DNNModule1.dll
C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\ModulePackage.targets(10,4): error MSB4062: The "MSBuild.Community.Tasks.XmlRead" task could not be loaded f
rom the assembly C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\*Undefined*\packages\MSBuildTasks.1.4.0.61\tools\MSBuild.Community.Tasks.dll. Could not loa
d file or assembly 'file:///C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\*Undefined*\packages\MSBuildTasks.1.4.0.61\tools\MSBuild.Community.Tasks.dll' or
one of its dependencies. The filename, directory name, or volume label syntax is incorrect. Confirm that the <UsingTask> declaration is correct, that the assembly and a
ll its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\websites\dnndev.me\DesktopModules\DNNMo
dule1\dnnmodule1.vbproj]
Done Building Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\dnnmodule1.vbproj" (default targets) -- FAILED.
Build FAILED.
Here is the screen shot of where I switch to release from debug. I must be missing something obvious.
Make sure that you are switching to RELEASE mode in the Toolbar in VS, not just the project properties. If you don't see the build toolbar, I recommend you configure VS for C# mode instead of VB, then the dropdown becomes easy to access.

Resources