-
Notifications
You must be signed in to change notification settings - Fork 424
Question - Using .NET Standard 2.0 libraries in VSIX projects #465
Comments
It depends on which version of .NET framework you are targeting and what your dependencies are. However the snippet you show should select the correct netstandard.dll to include as a dependency. |
I'm targeting .NET Framework 4.6.2. Is <Target Name="ExcludeSystemDataCommon" AfterTargets="ImplicitlyExpandNETStandardFacades">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="%(Filename) == 'System.Data.Common'" />
</ItemGroup>
</Target> This way I get the correct System.Data.Common assembly when publishing the project. Is there an easier way of overriding the System.Data.Common package and use version 4.1.0 instead of 4.3.0? |
It really depends on what the closure of your dependencies contains. If you are only referencing netstnadard2.0 binaries then that is likely enough but if you have any libraries referencing an earlier netstandard version then you might need some more assemblies to complete the closure. As for your System.Data.Common issue I don't think you really want either of those. In .NET Standard 2.0 that library is included. You might actually need to deploy the System.Data.Common that is in _NETStandardLibraryNETFrameworkLib item group. |
If I just publish the project, I get the dll and the dependencies (netstandard.dll, System.Runtime.dll, System.Data.Common.dll,...), but I need System.Data.Common.dll 4.1.0 and the one that is deployed is 4.3.0, which causes a FileNotFoundException at runtime. |
I suspect what you are missing is the binding redirects. See dotnet/sdk#1070. Try setting those 2 properties in your library project. |
I want to know what is the correct way of distributing a Visual Studio extension with .NET Standard 2.0 libraries.
The libraries I use were targeting .NET Standard 1.5 and I would add references to System.Runtime, System.Reflection,... in the VSIX project, then set
ForceIncludeInVSIX
metadata totrue
and the references were included in the VSIX.After upgrading Visual Studio 2017 to version 15.3 and installing the .NET Core 2.0 SDK, this no longer works, resulting in missing references.
Now I'm upgrading the libraries to .NET Standard 2.0, what should I do to make sure the extension will work? Should I include
netstandard.dll
?Currently I'm using this MSBuild target in the VSIX project:
The text was updated successfully, but these errors were encountered: