question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Workflow XAML compiler is broken with netstandard assemblies

See original GitHub issue

Repro:

  1. Create a workflow console application targeting net461.
  2. Add a reference to a netstandard1.5 or later library.

Expected: Compiles w/o warnings and runs successfully.

Actual: Warnings

Severity	Code	Description	Project	File	Line	Suppression State
Warning		Could not compile workflow expressions because file 'file:///C:\Program Files (x86)\Microsoft Visual Studio\IntPreview\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\netfx.force.conflicts.dll' has an incorrect format. Workflows in this project may still run, if they do not require expression compilation. If the file is a platform-specific library or executable, consider building the project using MSBuild.exe from a command prompt of the targeted platform.	WorkflowConsoleApplication1	C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets	347	
Warning		Could not run workflow validation because file 'netfx.force.conflicts, PublicKeyToken=cc7b13ffcd2ddd51' has an incorrect format. This will not prevent workflows from running; but any workflow that has a validation error will fail at runtime. If the file is a platform-specific library or executable, consider building the project using MSBuild.exe from a command prompt of the targeted platform.	WorkflowConsoleApplication1	C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets	347	

Applying the netfx.force.conflicts workaround merely causes the warning to occur on the next reference dll (system.data.common).

When in this state workflows will not execute, see https://github.com/dotnet/corefx/issues/23439.

We may need to give up on passing reference assemblies to desktop projects. If that’s the case we’d switch to just passing in the libs to the compiler and we’d need to build a version of netfx.force.conflicts.dll that doesn’t have the reference assembly attribute.

/cc @dsplaisted @weshaggard

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:36 (20 by maintainers)

github_iconTop GitHub Comments

8reactions
ericstjcommented, Aug 22, 2017

Here’s what I came up with:

  <Target Name="ReplaceRefWithLib" BeforeTargets="ResolveAssemblyReferences">
    <ItemGroup>
      <_noCopyRefs Include="@(Reference)" Condition="'%(Reference.Private)' == 'false'"/>
      <_noCopyRefsByFileName Include="@(_noCopyRefs->'%(FileName)')">
        <OriginalItem>%(Identity)</OriginalItem>
      </_noCopyRefsByFileName>

      <_libByFileName Include="@(ReferenceCopyLocalPaths->'%(FileName)')">
        <OriginalItem>%(Identity)</OriginalItem>
      </_libByFileName>

      <_overlappingRefByFileName Include="@(_noCopyRefsByFileName)" Condition="'@(_noCopyRefsByFileName)' == '@(_libByFileName)' AND '%(Identity)' != ''" />
      <_overlappingLibByFileName Include="@(_libByFileName)" Condition="'@(_noCopyRefsByFileName)' == '@(_libByFileName)' AND '%(Identity)' != ''" />

      <_overlappingRef Include="@(_overlappingRefByFileName->'%(OriginalItem)')" />
      <_overlappingLib Include="@(_overlappingLibByFileName->'%(OriginalItem)')" />
    </ItemGroup>

    <ItemGroup Condition="'@(_overlappingRef)' != ''">
      <Reference Remove="@(_overlappingRef)" />
      <Reference Include="@(_overlappingLib)">
        <Private>false</Private>
      </Reference>
    </ItemGroup>
  </Target>

  <Target Name="RemoveNetFxForceConflicts" AfterTargets="ResolveAssemblyReferences">
    <ItemGroup>
      <ReferencePath Remove="@(ReferencePath)" Condition="'%(FileName)' == 'netfx.force.conflicts'" />
    </ItemGroup>
  </Target>

This is a bit of hammer, but its close to the behavior you get anyways with packages.config (barring any bugs in my target).

2reactions
darrensteadmancommented, Dec 11, 2017

I’m not completely sure this is fixed.

If I remove the workaround from the csproj files it now compiles without any problems but it just throws exceptions at run time about netfx.force.conflicts. If I remove ReplaceRefWithLib I then get run time errors saying it can’t load assemblies. Looking at those assemblies it appears they are ones that reference netstandard 2.0.

It kind of looks like the problem has moved from compile time to run time.

I’m running VS 2017 15.5.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workflow XAML compiler is broken with netstandard assemblies
Repro: 1. Create a workflow console application targeting net461. 2. Add a reference to a netstandard1.5 or later library. Expected:
Read more >
Problem with assembly resolve in xaml (workflow) after ...
I have an old project with workflow (Appfabric) files in xaml and that project was targeting framework 4.0. We needed to update framework ......
Read more >
asssembly missing reference when only xaml uses type
Seems like a bug in the xaml compiler. I am experiencing this also in two of my projects. https://social.msdn.microsoft.com/Forums/vstudio/en-US ...
Read more >
What's new in .NET Framework
See what's new in various versions of .NET Framework. Read a summary of key new features and improvements in each version.
Read more >
Episode 3 - CoreWF With Dustin Metzgar
In this episode I interview Dustin about CoreWF, the Windows Workflow Foundation, and a little about the challenges of converting a .NET Framework...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found