When trying to obfuscate a UWP (WinRT) AnyCPU assembly using CryptoObfuscator, the following error messages are observed:
1.) When merging in LogicNP.CryptoLicensing.WinRT.dll (a WinRT assembly) into a UWP DLL:
Error occurred while obfuscation: - .Net framework version type of the licensing assembly (Silverlight) does not match the version type of the obfuscating assembly (Normal).
2.) When merging of the licensing assembly is ignored:
Error occurred while obfuscation: System.IO.FileNotFoundException - System.IO.FileNotFoundException: could not result: System.Runtime, Version=4.0.20.0, Culture=neutral... Specify the path where this assembly resides using 'Search Directories'
Has anyone successfully used CryptoObfuscator (which is advertised as working on any .NET assembly) successfully?
There are in fact two issues to take into account when using CryptObfuscator in this scenario:
To obfuscate for other .NET versions, the following must be added to each relevant csproj in addition to setting the target framework to :
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
This resolves most can not find file issues when obfuscating.
For System.Runtime, you will need to download and open the NuGet package of System.Runtime. In the lib folder you will find some nice hacks that depend on the CLR in use and glue the rest of your .NET assemblies together with the CLR, such as using forwarded types for .NET 4.7. But in the ref folder such as for netstandard1.5 you will find a System.Runtime.dll. Copy that one manually to the output folder or a location where CryptoObfuscator will search.
You can also put it in another folder, and specify in CryptoObfuscator a search directory using Project Properties or in XML:
<SearchDirectories>
<SearchDirectory Path="PATH" />
</SearchDirectories>
Try Download from nuget "Microsoft.NETCore.UniversalWindowsPlatform" and copy "System.Runtime.dll" downloaded from nuget to CryptoObfuscator folder.
Related
I am trying to use MathNet.Filtering (https://github.com/mathnet/mathnet-filtering) and I receive during runtime the error Could not load the file or assembly 'MathNet.Filtering, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null or one of its dependencies . The system cannot find the file specified. This happens when trying to use any part of the MathNet.Filtering class.
Such as
MathNet.Fitering.OnlineFilter myFilt = MathNet.Filtering.OnlineFilter.CreateBandpass(MathNet.Filtering.ImpulseResponse.Finite, 8000,100,15000,50);
I am already referencing MathNet.Numerics as it is a dependency to MathNet.Filtering.
I am compiling and running with .NET 4.6.1 and the dll for MathNet is built to target .NET 4.6.1.
Using dotPeek I can see there are other dependencies:
MathNet.Numerics (already referenced version 4.9.1.0)
mscorlib
System
System.Core
System.Numerics
System.ValueTuple
[]
I am struggling to see why I am getting Could not load the file or assembly . There are no external references missing.
Is the problem related to System.ValueTuple?
I can use the MathNet.Numerics classes without any issue, this has all the same dependencies except System.ValueTuple
But when I try and explicitly reference System.ValueTuple's DLL I receive
System.ValueTuple exists in both [path to reference] and C:\Windows\[...]\mscorlib.dll
Any ideas what is going on here? Stuck at this for hours
Thanks
I have a .NET Core project with many libraries as dependencies.
I wanted to change code in one of the library (a dll dependency) and wanted to run the project using the said new dll.
I changed the file version of the dll in the deps.json file but when i run the project using dotnet project.dll I see this exception thrown:
Application startup exception: System.IO.FileNotFoundException: Could not load file or assembly 'CuPletEngine, Version=16.0.229.1809, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
I made the change to deps.json file in order to force the application to to look for a different dll version.
Why would it still look for older version?
Please help.
On Windows 7 with .NET 4.5.2 installed, I create a new ClassLibrary project targetting .NET 4.5.2.
I want to calculate the code metrics for that assembly by launching the metrics.exe that is shipped with FxCop with Visual Studio 2013 located in c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\.
Everything works fine.
I then nuget System.Collections.Immutable v1.1.37.
I can see in the references that only System.Collections.Immutable is referenced since the other dependencies (System.Runtime, System.Collections, System.Diagnotics.Debug etc.) are found (I suppose in c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Facades\)
I create a dummy method that creates a dummy ImmutableArray var foo = new List<int>().ToImmutableArray();
Everything compiles and works just fine.
I relaunch the metrics computation.
I have the following error:
metrics.exe /f:c:\dev\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll /o:toto.xml
error : CA0055 : Could not load file:
'c:\dev\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll'.
If I perform the same command on the System.Immutable.Collections assembly, I have the following error:
Calculating metrics for file 'c:\dev\ClassLibrary1\ClassLibrary1\bin\Debug\System.Collections.Immutable.dll'.
Could not locate the framework assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Now, if I copy the System.Runtime file located in c:\Windows\Microsoft.NET\Framework\v4.0.30319\ in the output directory, calculating the code metrics on ClassLibrary1.dll works fine. But if I copy the version that is in c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Facades\, if fails again.
When debugging another library using Immutable in a web application, I can see the following in the "Loaded modules":
System.Runtime.dll C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll Yes No Skipped loading symbols. 544 4.06.1055.0 06/11/2015 03:49 000007FED10D0000-000007FED10D9000 [15760] w3wp.exe [4] /LM/W3SVC/2/ROOT/WebSite-2-131026947404276669
All of this makes me think that System.Collections.Immutable uses the version of System.Runtime that is in c:\Windows\Microsoft.NET\Framework\v4.0.30319\
So I thought, "let's add an explicit reference to that assembly." If I do, I got the following compilation error:
error CS1703: Multiple assemblies with equivalent identity have been imported: 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades\System.Runtime.dll'. Remove one of the duplicate references.
There something somewhere that is wrong and I can't pinpoint it.
I worked around the error by using the /ignoreinvalidtargets for metrics.exe.
Does anyone have a club about the real error?
(I also tried targetting .NET Framework 4 and adding references to all the dependant assemblies from c:\Windows\Microsoft.NET\Framework\v4.0.30319\ with CopyLocal = true. It works, despite the following warning:
Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: System.Collections, System.Collections.Immutable, System.Diagnostics.Debug, System.Globalization, System.Linq, System.Resources.ResourceManager, System.Runtime, System.Runtime.Extensions, System.Threading
)
Thanks.
I have developed an EXE again :)
The problem is it has refernces of SQLite dll file so I included the file on the same path. Now in Windows 8 it is running fine, but in Windows 7 it is not
The error is
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.90.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. (Exception from HRESULT: 0x800736B1)
File name: 'System.Data.SQLite, Version=1.0.90.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' ---> System.Runtime.InteropServices.COMException (0x800736B1): The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
I did everything I could but it is not running on Windows 7
It's a standalone EXE. No Setup.
EDIT:
This is what application event log says
Activation context generation failed for "C:\System.Data.SQLite.dll". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195" could not be found. Please use sxstrace.exe for detailed diagnosis.
I think thats the reason as you mentioned, SQLLite is searching 64 bit dll!
Try to download 64 bit url and pack it with exe
You can download from here
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
side-by-side configuration is incorrect
That means Either:
One of your reference DLLS do not match your project target type
Or Your reference DLLS are of mixed target types
Solution:
Make sure your Project is set to build to target x86 for x86 reference DLLs or target x64 for x64 reference DLLs, and the same for the .NET versions
Make sure all your reference DLLs are either all x86 or all x64 versions and not x86 and x64, and the same for the .NET versions
If you are not sure you can use IlSpy to check by right clicking on the reference.
Generally this error indicates that a dependent assembly is missing.
Activation context generation failed for "C:\System.Data.SQLite.dll".
Dependent Assembly
Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
could not be found. Please use sxstrace.exe for detailed diagnosis.
This assembly is more commonly known as
Microsoft Visual C++ 2005 Redistributable Package (x86)
and can be downloaded from here.
But, often there is another cause. Today, for us, it was "Bit9 Security" which did not like us digitally signing the SQLite.dll assembly on our local machine and uploading the signed assembly to our server application folder with a different time stamp to the rest of the assemblies in the application folder.
The work around was to recompile the application, sign all the assemblies, upload and overwrite the existing application files.
I built a web application that uses the J# libraries which works fine in my cpu, however, when I deploy it to my shared server. I get an error message: Parser Error Message: Could not load file or assembly 'vjslib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
So basically, the server doesn't have visual j# installed. The problem is they wont install it because it is a shared server.
Is there a way I can deploy the J# assemblies with my project so that it will work on the shared server without it being registered in the GAC?
Thanks for your help!!
Simplest solution: Try to copy the assemblies your application needs into the same folder where your application resides.
The following MSDN article explains How the Runtime Locates Assemblies.
Also, you may find more options (including copying all J# related dlls into a subfolder of the application folder if needed) in the following link when the runtime cannot find the assembly in the GAC: Locating the Assembly through Codebases or Probing
Without knowing anything about J# I can only suggest that you try just distributing the required libraries along with your program (place them in the same directory), I believe if it can't find the library in the GAC it will revert to look in the current directory.