I've installed recently released Visual Studio 2017 and created a .NET Standard Class Library project.
The .cproj just targets .NET Standard v1.4:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
</Project>
Within Visual Studio, it states that it successfully referenced the NETStandard.Library metapackage.
Within this library project, I have a simple class that utilizes System.Threading.Tasks.Task type.
using System;
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Class1
{
public Class1(Action action)
{
var task1 = Task.Run(action);
}
}
}
During the build in Visual Studio it does check compatibility with .NETStandard 1.4 against the dll-s found in nuget packages, however those dll-s are not copied to the output folder.
Checking compatibility for System.Threading 4.3.0 with
.NETStandard,Version=v1.4.
1> System.Threading.Tasks/4.3.0 1>
Name=System.Threading.Tasks 1>
Path=system.threading.tasks/4.3.0 1>
ResolvedPath=C:\Users\user-name\.nuget\packages\system.threading.tasks\4.3.0
1> Type=package 1> Version=4.3.0
The project compiles and produces dll (ClassLibrary1.dll) referencing only 2 assemblies: System.Runtime.dll and System.Threading.Tasks.dll.
Which are resolved to GAC dlls:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.dll
C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Threading.Tasks.dll
These are the Full .NET Framework 4.6.1586.0 assemblies, installed globally in my Windows and registered in GAC.
QUESTION: Is this a correct behavior? After reading the .NET Standard docs I was convinced that ClassLibrary1.dll would reference netstandard.dll which would act as a facade for nuget versions of System.Runtime.dll and System.Threading.Tasks.dll. And/or those dll-s would be copied into output directory along with ClassLibrary1.dll.
Related
I am using Visual Studio 2017 for a C++ project (created with VS 2015). I get the following error:
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(345): fatal error C1083: Cannot open include file: 'atltrace.h': No such file or directory
How can I install the ATL/MFC headers of the VS 2015 toolchain?
Details
"Platform Toolset" setting (at "Project properties/General/Platform Toolset")
set to "Visual Studio 2015 (v140),
changing the platform toolset to "Visual Studio 2017 (v141) compiles fine.
Files on disc
The include directory for VS 2015 (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\) contains afx*.h files but no atl*.h files.
These missing files seem to belong to VC_ATL.Headers.msi ("Visual C++ Library ATL Headers Package") (which I checked on another machine with those files). I could not get the respective msi to install. (I took the msi from the other machine.) Error: "To install this product, please run Setup.exe. [...]".
The respective directory for VS 2017 (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include\) does contain those files.
Installer
"Windows Desktop Development with C++/VC++ 2015.3 v140 toolset for desktop (x86,x64)" is checked.
It seems to me that the v140 toolset is missing the ATL/MFC headers.
"Windows Desktop Development with C++/MFC and ATL support(x86 and x64)" does not seem relevant, it seems to be about the VS 2017 version.
VC++ redistributable seems irrelevant since those do not contain the header files.
There is a blog post about the Visual C++ Build Tools 2015. The build tools are also released in a standalone version without the need to install Visual Studio 2015:
The Build Tools are the same C++ tools that you get with Visual Studio 2015 but they come in a scriptable standalone installer that only lays down the tools you need to build C++ projects.
Microsoft has included ATL/MFC.
They can be downloaded from http://landinghub.visualstudio.com/visual-cpp-build-tools. Make sure to select "ATL and MFC" which is deselected by default.
i have a class library project targeting net461 in visual studio 2017. and i only want the single dll built.
previously i can set Copy Local to FALSE in the references for assemblies and nuget. but now the option is not there.
how can i build only the single dll file for the class library in visual studio 2017?
I have a C# application which uses a C++ DLL, both of which I wrote. The C++ DLL is compiled using the v120 (Visual Studio 2013) Toolset. Which redistributables do I need to include in my InstallShield installer to make this function?
There is no option for a VS2013 redistributable package, only various VS2012 packages and two for VS2015.
A few of the (unhelpfully named) options: http://imgur.com/VuDNdNt
You need to get required redistributable from installed VS2013 (C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033). Then in InstallShield you have to execute custom command (redistr_exe with parameters /q /norestart)
There is a easy way to tell this. Add the dlls which are included in the c++ redistributables and it will automatically add the merge modules instead.
Add the following (x86).prq file of Visual C++ 2013 Redistributable in Installshield install path. In mine it is (C:\Program Files (x86)\InstallShield\2015LE\SetupPrerequisites).
http://pastebin.com/Yu5DM0kJ
After that open Installshield project, in redistributables you will see Visual C++ 2013 x86. You can do the same to add x64 also.
I opened my existing MFC project using Visual Studio and when I build I get the following error message:
Error 1 error MSB8031: Use of MBCS encoding in MFC projects require an additional library to be downloaded and installed. Please see http://go.microsoft.com/fwlink/?LinkId=286820 for more information. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\v120\Microsoft.CppBuild.targets
What is this about?
This error message is due to the missing MBCS MFC package. Starting with Visual Studio 2013, MBCS portion of the MFC library has been broken out of the Visual Studio product into its own separate download. Installing this package and rebuilding should fix the problem.
The download is available here
More information about this change is available here
Update for Visual Studio 2015
Starting with Visual Studio 2015, the entire MFC C++ library (including the MBCS pieces) is an optional install component. While installing VS2015, if you select C++ and MFC, you will also get the MBCS library.
Instead of installing an add-on, you may consider changing the character set from MBCS to Unicode.
This is done in the project properties as is depicted below.
For Visual Studio 2015:
According to Redistributing the MFC Library article on MSDN, there are no mfc140.dll files in redist directory (c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86).
The mfc140.dll files were omitted from the redistributable files
directory in Visual Studio 2015 RTM. You can use the versions
installed by Visual Studio 2015 in the Windows\system32 and
Windows\syswow64 directories instead.
I've got a shiny new laptop with the latest Dev tools installed such as Visual Studio 2010.
Now I've got a task to build a C++ CLR app targeting the 2.0 runtime (this is well outside my comfort zone). So I've specifed the v90 Platform Toolset but when I build I get:-
error MSB8010: Specified platform toolset (v90) requires Visual Studio 2008. Please make sure that Visual Studio 2008 is installed on the machine.
Seriously, do I really need to install 2008 as well? Is there some way round this, such as just copying in some folders from a 2008 install?
If not just how much of the VS 2008 installation do I need?
Part of the problem is that VS2010 redid how compiling in c++ (cli or not) works. It now uses the MSBuild structure but I believe what you are trying to do will need the VCBuild framework that is not in 2010.
You may be able to get away with using the Visual Studio 2008 express to build. If not you should only need the c++ portion of VS2008.
Do you need to use the vc90 target though? I build my c++/cli (still new myself) with the vc10 target and it builds fine. (however i am targeting the 4.0 framework referencing some 2.0 portions)
If you set the 'Platform Toolset' in general tab of your project settings to "inherit from parent or project defaults" it will work in most of the cases.
in *.vcxproj
<PropertyGroup Label="Globals"> //Globals
<ProjectGuid>{E0047D4D-366D-4870-980B-DBB5A375BCE2}</ProjectGuid>
<RootNamespace>ECGConvertWrapper</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> //there
</PropertyGroup>