I have a free .Net 4.0 app that protect with Eazfuscator v3.3 (last free version). All the classes in my single project app are internal. I use symbol encryption to encrypt class names, methods and members. Up until now, everything was encrypted
Up until now, I was using VS 2010, and everything worked fine. I switched to VS 2015, still targeting .Net 4.0 framework. Once the code is compiled and obfuscated, using reflector I can clearly see class names in clear (but methods and members are still encrypted)
Is there anything different between VS 2010 compilation and VS 2015 compilation if both target .Net 4.0?
Thanks
VS 2015 uses Roslyn compiler. It produces different instructions and metadata and this affects the analysis engine in Eazfuscator.NET 3.3.
Eazfuscator.NET 3.3 cannot work with assemblies produced by VS 2015 or newer.
The support for Visual Studio 2015 was added in Eazfuscator.NET 4.9, so you need at least that version to successfully obfuscate the assemblies produced by Roslyn compilers.
Related
I recently start to work on a legacy ASP.NET codebase based on .NET framework 4.0. We managed to pass everything from Visual Studio 2012 to VS 2017, updated the build server with a new version of Jenkins and installing .NET framework 4.7.x.
Locally we can write C# code of the newest version (7.3) and the build works (VS doesn't use MSBuild if I remember right), but when we deploy on the build server the build fails because there MSBuild cannot recognize constructs newer than C# 4.0. To avoid mistakes I fixed the lang version to 4.0 (advanced build properties on projects), so if I write too new C# VS blocks me in dev, but we would like to start using new C#.
We also tried to fix C# 7.3 directly in the project (<LangVersion>7.3</LangVersion> in PropertyGroup inside csproj) and the but ToolsVersion property of Project element (csproj) to 14.0, but then building we MSBuild fails with the error:
CS1617: Invalid option ‘6’ for /langversion; must be ISO-1, ISO-2, 3,
4, 5 or Default
Here it's explained that what I want to do it is possible: https://www.dotnetcurry.com/dotnet/1427/build-apps-different-dotnet-framework-versions
No matter which .NET framework version we target in the project, the
C# language version in use will not change. That’s fine because the
vast majority of language features that were introduced in later
versions of the language don’t depend on the CLR or specific APIs.
They are only syntactic sugar and the bytecode generated by the
compiler will still work in .NET framework 2.0.
Anyone have an idea of what mistake are we doing?
The problem was that on the build server MSBuild wasn't properly installed and build scripts got an old one.
Installing Visual Studio 2017 Build tools and fixing the path on the script we solved.
After we had the problem "The “GetReferenceNearestTargetFrameworkTask” task was not found" we solved like explained here: The "GetReferenceNearestTargetFrameworkTask" task was not found
(the right answer depends on what strategy have you used to install VS Buld tools).
I wrote some code in .NET Project on a windows 10 machine with visual studio 2017.
The target framework ist 4.5.2. and the used C# version is default (running the csc tool under "C:\Windows\Microsoft.NET\Framework\v4.0.30319" shows C# 5.
I have used a feature from C# 6. The Monadic null checking (https://damieng.com/blog/2013/12/09/probable-c-6-0-features-illustrated).
and the compiler doesn't complain about it.
Is that a normal bhaviour or am I missing something? Shouldn't the compiler complain about it?
What you're missing is that the C# compiler being used isn't the csc.exe you found. Visual Studio comes with its own C# compiler which supports C# 6 (and later, depending on the exact version of VS you've got installed).
C# language version is decided by Visual Studio, not by .Net Framework.
As long as your Visual Studio version supports the C# version you will not face any error.
Configuring Language version in Visual Studio: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
I have been trying to update my C# compiler after getting the below error when trying to compile a file:
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
I downloaded Roslyn as directed (not sure if it needed to go in a particular folder with the visual studio files) but didn't get any further with it.
I also found guidance to run the below command in visual studio :
Install-Package Microsoft.Net.Compilers
But this also generates errors when attempting, regardless of whether or not a solution is open.
I'm trying to get the compiler to update to version 6, I feel like this should be very simple but I haven't gotten anywhere with the advice I've researched. Any ideas?
If you are using Visual Studio 2015 Community Edition you should already have the C# 6 compilers since they shipped with Visual Studio 2015.
I just installed the RTM version of Visual Studio 2015 Community Edition on a clean system. The csc.exe compiler it installs (under C:\Program Files (x86)\MSBuild\14.0\Bin\ reports itself as Microsoft (R) Visual C# Compiler version 1.0.0.50618. The file's modified date is 6/21/2015.
The help section on the langversion switch reports /langversion: <string> Specify language version mode: ISO-1, ISO-2, 3, 4, 5, 6, or Default
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
The wording of this warning message suggests that you are using a version of the C# compiler shipped with the .NET Framework rather than one that was shipped with Visual Studio 2015.
This is a rather general question, a result of my confusion about how to compile GDAL using different versions of Microsoft Visual C++ (MSVC) and its C#-bindings. I understand that MSVC is a compiler and there are different versions (MSVC 2003, 2005, 2008, 2010, 2012). I also understand that C# is tied to the .NET framework, which is a software development framework that also comes in different versions (.NET 1.0 to 5.0).
I want to compile GDAL (because I want to use an extension not included in the SDK builds available here) to be used by C# (via its C#-bindings) using VS 2012, which version of MSVC would I have to use? I guess the answer is MSVC 2012 (same .NET framework version), but why actually? The GDAL build would create DLLs. Is the .NET framework not backwards compatible in the sense that I can use DLLs compiled with an older version of MSVC inside a C#-project that uses VS 2012?
Any enlightenment appreciated.
The relationship is largely irrelevant unless you're toying with C++/CLI (which it doesn't look like you are).
C# uses native DLLs either by using P/Invoke (aka DllImport) or through COM, it doesn't matter what compiler they were made with so long as the exports are in the right format (and they're in the right ISA for the executing .NET platform).
Using the same C++ compiler that VS ships with just saves you the trouble of hunting down alternative tools and simplifies your build process.
I am porting a project built on VS2008 to VS2005 since the minor .NET version for us have to 2.0 instead of 3.5 and rest of our code is building on VS2005. So I modified the visual studio version from 2008 to 2005 at the .sln file
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
So I am able to load the .sln into the VS2005. I have some building problem, mainly the "var" and after I modified those lines with real data type, the code compiles and runs.
However at the project assembly reference. I found out that my code is still reference Linq which is from .NET 3.5:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll
When I open up the dialog to add new reference, I could see that the .NET version 2.0, 3.5 and even 4.0 (although the CLR runtime version is 2.0.50727 in most of cases. sometimes 1.x and sometimes 4.0, Linq's runtime version is 2.0.50727).
I thought that VS2005 only supports .NET 2.0 which seems not that case here. So I guess how can I make sure that my application would only require .NET 2.0 framework. Is it enough to make sure that I only reference .NET 2.0 and below reference?
As long as the target framework is .NET 2.0 and you don't reference any libraries that do target higher .NET framework versions, your app should run just fine on .NET 2.0.
That said, I believe Visual Studio 2008 supports multi-targeting, so you should be able to use VS2008 but still target .NET 2.0 as your output type. Additionally, VS2010 and VS2012RC also support .NET 2.0 only projects.
To answer the exact question in the title (for the benifit of those who find this page by its title) the .NET version used by default in Visual Studio 2005 is .NET v2.0.
You can still use VS2008. VS2008 fully supports 2.0-only projects (just change the project settings). When in 2.0 mode VS will disable any 3.0 and 3.5 assemblies as well as any C# language features that depend on 3.0 or 3.5 library classes (such as extension methods, but there is a workaround to get those working with 2.0).
I'll say that VS2010 also supports 2.0-only projects too.