Reputation: 3360
Had a working ASP.NET Core using a .NET Standard DLL I wrote. I'd like to use TransactionScope
in my DLL now, but getting this issue:
.NET Standard and .NET Core 2.0 both recognize System.Transactions, but .NET Framework 4.6.1 is giving an error and won't compile with MSBuild. Visual Studio 2017 offers the following helpful information:
I cannot seem to find a way to force the project to recognize System.Transactions.dll from my system's Framework/Framework64 folders.
Yes, I can use dotnet build
to compile the .NET Core version, but that's not what I want... I want to be able to compile for .NET 4.6.1, too.
Upvotes: 5
Views: 578
Reputation: 100543
You need to add a framework referenced conditioned on the target framework.
Add this to your csproj file:
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Transactions" />
</ItemGroup>
Upvotes: 6