Dotfuscator Error when integrating into VB winform Application - vb.net

I am trying to integrate obfuscation into the build of a project. I am using Visual Studio 2019 CE 16.11.5 and the project is a VB winform Application targeting .net 4.6. Windows 10 Pro x64.
As soon as I add required lines into my project files and save. Visual studio unloads my project, showing the following message in output window:
error : The imported project "C:\Program Files (x86)\MSBuild\PreEmptive\Dotfuscator\6\PreEmptive.Dotfuscator.Common.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)/MSBuild/PreEmptive/Dotfuscator/6/PreEmptive.Dotfuscator.Common.targets" is correct, and that the file exists on disk.
I checked the folder in the error message and it is not there. I uninstalled and installed Dotfuscator still the required folder is not created.
I also have VS 2022 CE installed.
What am I missing?

Related

Visual Studio 2019 Solution does not build exe file for Windows Service Project

Recently converted VB.NET solution from Visual Studio 2013 4.0 Framework to Visual Studio 2019 4.8 Framework. The solution contains 22 project. Of the 22 projects there is one Windows Form Application and one Windows Service project.
In Visual Studio 2013, compiling the solution would create two .exe files. One for the Windows Form project and another for the windows service project.
After converting to Visual Studio 2019 and compiling the solution, there is only one .exe file being created. That .exe file is for the Windows Form project (startup project).
When solution was being compiled using VS 2013, both .exe files would get created.
Does anyone know what I need to do to get VS 2019 to create the two .exe output files when compiling? Thanks

Brand new CLR Class Library project won't build: missing MSCOREE.lib

Using the latest Visual Studio 2019 version, a brand new project will not build:
fatal error LNK1104: cannot open file 'MSCOREE.lib'
I have tried to re-install Visual Studio but that didn't change anything unfortunately.
These components have been selected by the installer but apparently it's not enough:
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.24)
Windows 10 SDK (10.0.18362.0)
C++/CLI support for v142 build tools (14.24)
Question:
Are there any tricks to get CLR Class Library (.NET Framework) projects to build ?
Here is the solution:
Apparently, no matter what framework version you will target, the $(NETFXKitsDir)Lib\um\x86 macro will always point to C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x86.
Now here's the problem, even though you install 4.7.2 SDK in Visual Studio Installer, this file is nowhere to be seen.
But if you download .NET Framework 4.7.2 Developer Pack Offline Installer and press the Repair button, it gets correctly installed and a brand new project will build succesfully.
Alternatively:
Re-installing VS also fixes the issue ...

msbuild fails to compile vsto project

We recently installed a new development environment (Windows 10) from scratch with Visual Studio 2017 but we cannot manage to make msbuild compile a Microsoft Office Addin for Word (vsto).
Within the Visual Studio installer we made sure to include the required components for Office Development.
It throws the following error (german translated to english)
error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found. Also, tried to find "OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" [...]
However, the project builds fine within Visual Studio.
On the old system, everything works fine, and i cannot remember having to configure anything at all.
You need to install Office build tools when installing Build Tools for Visual Studio 2017
In my case, I managed to get around the issue by copying the folder
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio
from the development environment (the old environment in your case) to
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio
on the build environment (the new environment in your case). I would have thought that one should be able to simply get the relevant targets from the Build Tools for Visual Studio 2017 but that appears not to be the case.
After reinstalling everything it works now.
I guess back then when we set up this machine, the build tools setup was bugged or something.
Now we could install everything we needed for the buildtools using the visual studio installer and it works like a charm.
Okay, so I've worked through this one now. The problem was caused by me using Windows\Microsoft.NET\Framework64\v4...\Msbuild.exe.
It looks as though running msbuild from this location results in it not being able to implicitly locate many of the assemblies and build utilities required to build a VSTO project.
I resolved the problem by switching to using C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe

How to open dotnet-core CLI project in Visual Studio 2017

I have been developing a simple application using dotnet Core (for an API) and Angular2 for the purpose of learning both.
I created the project using Yeoman on the command line and have been happily coding away in Visual Studio Code (on Windows). All seems to hang together well and it's been an enjoyable experience.
I thought I might try out Visual Studio 2017 and see what the experience of developing a dotnet Core project in VS is like for a while.
However, having installed VS2017 and cloned the project from github I am unsure how to proceed. I can't see any way to restore/build/run the project.
After cloning the repo, I see my project displayed in the Solution Explorer with the project.json file visible. However, Debug | Start is greyed out. I read somewhere about VS2017 needing to convert project.json to the new (old?) XML format and also I have a feeling I am missing a .sln file.
I would appreciate it if someone could point me in the right direction.
If your project has an .xproj file
Open Visual Studio.
File > Open > Project/Solution.
Open the xxx.xproj for your solution.
If your project lacks an .xproj file
Install .NET Core SDK Preview 3 or higher.
Open a command prompt at your project's directory.
Run dotnet migrate.
Open the resulting .csproj in Visual Studio 2017.
Troubleshooting
View migration help with dotnet migrate -h.
If you have a global.json file, update its SDK version before running migrate. E.g.
{
"sdk": {
"version": "1.0.0-preview4-004233"
}
}
View installed SDK versions with dir 'C:\Program Files\dotnet\sdk\'.
Update Visual Studio 2017 and its installer. On my machine, the above works with Microsoft Visual Studio Community 2017 RC Version 15.0.26014.0 D15REL.
Update .NET Core SDK. On my machine, the above works with SDK 1.0.0-preview4-004233.

Why does my build app fail when run outside of VS12 (i.e. when deployed)?

I've written a c# program that builds *.csproj and *.vcxproj using Microsoft.Build.Evaluation. It works great on both project types if I compile and run it from inside Visual Studio 12. But if I run the exe directly (outside of Visual Studio) I get the example error message below. The error occurs only for vcx projects; c# projects continue to build just fine
Question: Why am I getting this error? Why does my program work fine for both C# and vcx projects when run from within VS12, but fails, but only for vcx projects, when run outside of VS12?
Please don't chastise me for not using MSBuild.exe. My orders were to programmatically build C# and vcx projects using Microsoft.Build.Evaluation.
Code:
using Microsoft.Build.Evaluation;
...
Project proj = new Project("MyCppProject.vcxproj");
proj.Build(logger);
Runtime Error:
Building MyCppProject
Project "MyCppProject.vcxproj" (default targets):
VCMessage:
ERROR C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(518,5): Specified platform toolset (v110) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
Done building project "MyCppProject" -- FAILED.
One solution is to force the Visual Studio version as an environment variable prior to loading and building the project:
using Microsoft.Build.Evaluation;
...
Environment.SetEnvironmentVariable("VisualStudioVersion", "11.0")
Project proj = new Project("MyCppProject.vcxproj");
proj.Build(logger);
Visual studio maintains platform tool sets list supported for the version of Visual studio you are currently running for example on my machine I have VS 2008, 2010 and 2012
Now suppose when I install Visual Studio 2013 which has a Platform Toolset version of V120. What happens, is that the project saves this in its corresponding XML files in the format (vcproj, vcxproj, vcxproj.filter.user files).
now this valus is not known to VS 2012 so it complains when opened in VS 2012.
Similarly for opening VS 2012 project in VS 2010, as in your case and so on.
Solution:
To fix this issue, Open you solution file in notepad++.
Make these 2 changes
1) Replace
Format Version 12.00
with
Format Version 11.00
2) Replace
Visual Studio 2012
with
Visual Studio 2010
Then open the file again in visual studio and rebuild solution.