Dotfuscator CE Build Error: External type not found System.Windows.Input.ICommand,PresentationCore - icommand

I have an application targeting the .NET Framework 4.0. It builds and runs fine but I cannot get it to compile in Dotfuscator CE and they will not support it since it is CE. I am stuck.
Dotfuscator CE (v5.0.2500.0) with Visual Studio 2010 SP1. This is the Error:
Resolving method references...
External type not found System.Windows.Input.ICommand,PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Build Error.
The problem seems to originate from Microsoft changing ICommand from PresentationCore.dll in NET 4.0 to System.dll in NET 4.5. Studio handles this and compiles fine as I am targeting NET 4.0.
Dotfuscator CE does not handle it and I am not sure how to correct the issue. Any help would be greatly appreciated.

Find the path of .NET4's PresentationCore.dll, such as C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0
On Dotfuscator's setting tab -> User Defined Assembly Load Path;
Add PresentationCore.dll's path to the path list and check the Search first.
Hope it work for you.

Related

VS2017 MSBuild autodetection takes MSBuild/v14 instead of v15 for WPF project

We are slowly migrating to VS2017 and most of the project do that silently without much interference. Today started migrating a WPF project from VS2015 to VS2017. When I build the solution I get the following warning:
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
I googled the problem but I seem to be alone out there. I have no clue what could cause this. The .Net target is 4.5.1 but changing that to 4.6.2 make no difference. Neither does clean or remove bin and obj directories. Who has got a clue?
I encountered this problem while building from the command line after migrating from VS2017 to VS2019 for a solution containing class libraries. I found I had VS2017's version of MSBuild in my PATH environment variable - C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin. Removing that path from the environment variable and re-opening my console solved the issue.
VS2017 MSBuild autodetection takes MSBuild/v14 instead of v15 for WPF project
You can try to update the version of nuget.exe to the 4.0 and above in the .nuget folder.
Visual Studio 2017 comes with NuGet 4.0 and NuGet 4.0 Package Manager Extension is currently not available for Visual Studio 2015 (Visual Studio 2015 comes with NuGet 3.4.4, and NuGet 3.5.0 is available as an explicit download for Visual Studio 2015 as well).
According to your comment, it seems the old nuget.exe not detect the MSBuild version 15.0, so please try to update the nuget.exe to 4.0 and above in the .nuegt folder.
Besides, I found your solution that is still configured by old package restore method "MSBuild-integrated restore", which is the original Package Restore implementation and though it continues to work in many scenarios, it does not cover the full set of scenarios addressed by the other two approaches.
Automatic Package Restore is the NuGet team's recommended approach to Package Restore within Visual Studio. You can convert to use the automatic package restore. Check the following thread for details:
Nuget: Switching from "Enable Package Restore" to "Automatic Package Restore"
Hope this helps.

In Visual Studio 2012 where does ClickOnce "Publish" expect to find the .Net 4 client profile?

The Publish feature stopped working once I installed Visual Studio 2012. Publish cannot find the prerequisite Microsoft .Net Framework 4 Client Profile (x86 and x64). Previously in Visual Studio 2010 this worked fine. I use 64-bit Windows 7.
The exact Visual Studio 2012 error message reads:
Error 104 - To enable 'Download prerequisites from the same location
as my application' in the Prerequisites dialog box, you must download file
'DotNetFX40Client\dotNetFx40_Client_x86_x64.exe' for item 'Microsoft .NET
Framework 4 Client Profile (x86 and x64)' to your local machine. For more
information, see http://go.microsoft.com/fwlink/?LinkId=239883
I placed the file dotNetFx40_Client_setup.exe in the location:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages\DotNetFX40Client
I also left it in it's original location (note the v7.0A):
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40Client
Edit (after solving the problem): I see that the correct setup file (dotNetFx40_Client_x86_x64.exe) is actually in the v7.0A folder. Had I just copied it from there everything would have worked (rather than downloading the wrong setup).
Publish works fine when I change the option "Download prerequisites from the same location as my application" to "Download prerequisites from the component vendor's website" (at project Properties -> Publish -> Prerequisites...)
I noticed a yellow exclamation point beside the (checked) "Windows Installer 3.1" with the warning: "Prerequisite could not be found for bootstrapping". For that I have the file WindowsInstaller-KB893803-v2-x86.exe in the folder:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\WindowsInstaller3_1
The application has run fine within my company's network for the past year when published with Visual Studio 2010. I opened the solution file in VS 2012 (for the first time) and it compiles and runs fine locally. Only the Publish feature is broken.
Am I missing something? Where is ClickOnce Publish expecting to find these prerequisites for my WPF application?
I'm answering my own question. The problem went away when I used a different .Net 4 Client setup program. The exe that works for me is dotNetFx40_Client_x86_x64.exe found at:
http://www.microsoft.com/en-us/download/details.aspx?id=24872
The wrong setup program is dotNetFx40_Client_setup.exe which I was led to by following the Microsoft MSDN help topic How to: Include Prerequisites with a ClickOnce Application (Visual Studio 2012) which led me to this link to the setup. I use Chrome which downloaded the web installer which I didn't realize was not the file I needed. Had I been using IE none of this would have happened. I was clued into the problem by this StackOverflow question which suggests renaming the setup program. Instead of renaming it I just downloaded the correct one.
re: Windows installer: VS2012 doesn't include the same prerequisites as VS2010, but you can copy the package from the previous SDK folders to the new one, and it will magically show up in the prerequisite list in VS2012 and work!

WCF RIA services and System.ServiceModel.DomainServices.Hosting

I am developing my first project using WCF RIA services. I was able to build a small application and ran it successfuly on localhost. When tried to upload on a server, I got the following error when browsing it :
"Could not load file or assembly
'System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified"
I looked for this reference on my project and did not find it. I tried to add it from C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Server, but Visual Studio warns me:
You cant add a reference to
System.ServiceModel.DomainServices.Hosting.dll as it was not built
against the silverlight runtime.silverlight projects will only work
with silverlight assemblies
What should I do?
Thanks
Found the problem: on my .Web under references, found the needed dll.On properties, changed copy local to True

Using EF Reverse Engineer Code First wizard, getting error after installing Silverlight 5

I used the wizard once last week with no problems. Now, after installing Silverlight 5 I get:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude(1024,76) : error CS0433: Compiling transformation: The type 'System.Xml.XmlReader' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Xml.dll' and 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.XML.dll'
I realize you asked this forever ago but I happened upon a solution that worked for me...
This is actually a bug in the EF Power Tools that they are actively working on ...
If you edit
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude
or
EF.Utility.VB.ttinclude if you are using VB
change the assembly lines that include the XML assemblies to explicitly not use the SL libraries then it starts working
so change them to
<## assembly name="System.Xml, Version=4.0.0.0, Culture=neutral" #>
<## assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral"#>
Then it should start working

How do I use Microsoft.Build.BuildEngine to Build a Silverlight project?

I am using the Microsoft.Build.BuildEngine to build a number of projects. Projects that do not use Silverlight are building correctly while projects that do use Silverlight are not building. All of these projects (Silverlight and non-Silverlight) all build fine through Visual Studio 2008. I get the error message:
error CS0234: The type or namespace name 'SilverlightControls' does not exist in the
namespace 'System.Web.UI' (are you missing an assembly reference?)
I've added System.Web.Silverlight to the project that is doing the build using Microsoft.Build.BuildEngine. I am able to see that namespace in the project doing the build also (so it appears that the project doing the build does have access to System.Web.UI).
Any ideas on how I can avoid that error?
Turned up the verbosity on the build through VS2008 and compared to the log created from the Microsoft.Build.BuildEngine. It looks like the Microsoft.Build.BuildEngine is producing lines like:
Considered "c:\Program Files\Reference Assemblies\Microsoft\Framework
\v3.5\System.Web.Silverlight.dll", but it didn't exist.
It doesn't exist in that location, should it? There are actually a number of locations that it looks for that dll and doesn't find it. I added the reference by right clicking, add reference, .Net, add. There doesn't appear to be a System.Web.Silverlight.dll on my machine (which is odd because the project does compile using VS2008).
Comparing the possibly relevant sections of the two logs:
Microsoft.Build.BuildEngine
For SearchPath "{GAC}".
Considered "System.Web.Silverlight, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL", which was not found in
the GAC.
Visual Studio 2008
System.Web.Silverlight, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Manually added System.Web.Silverlight to the path that the Microsoft.Build.BuildEngine was looking for it (coppied it from the output directory when I build the project via VS2008). This solved that problem, but I now get the following errors on the Silverlight components of the solution:
C:\Program Files\MSBuild\Microsoft\Silverlight
\v2.0\Microsoft.Silverlight.Common.targets(95,9): error : The Silverlight 2 SDK is not
installed.
Any ideas?
In the application that is running the Microsoft.Build.BuildEngine I changed the type of build from Any CPU to x86. This has now made the application be able to build the target as expected.
So you're programmatically building using the MSBuild APIs?
It may be useful to add an ILogger (e.g. that just prints to the console) to engine.Loggers, and compare the output with the output window in VS (after setting e.g. 'tools\options\project & solutions\build & run\msbuild output verbosity' to verbose)... seems like somehow the environment is causing assemblies to resolve differently?
Set build type of project to Any. This helps. Happy coding...

Resources