Open dpaoliello opened 7 years ago
Would I have the same problem if I'm running "dotnet build" command in Debian? My project compiles in Windows but not in the build server.
@dpaoliello Did you find any workarounds?
💭 Sounds like MSBuildWorkspace
is using an older version of the MSBuild internals. Not sure why though.
@uhaciogullari I was lucky enough that the only Remove
attribute in my code base was not actually being used by the project, so I refactored my targets files to put the Remove
into its own targets file which is conditionally not included by the project I was loading.
@sharwell Given that the Remove
attribute was added in .NET 3.5, I don't believe that this is the case. It's more likely that the MSBuild parsing was rewritten for Rolsyn and this feature was never implemented.
@dpaoliello I've used remove a whole bunch recently in my work to convert projects to the new project system. For example, it's used by default to prevent <Compile>
items from also appearing as <None>
items in the project.
💭 I'm not sure that documentation is correct. I tried earlier this week to use Remove
in Visual Studio 2013 and got an error. I just reproduced it too:
Remove
has been available since MSBuild 3.5 within a Target
element. In MSBuild 15, we started supporting it in a top-level ItemGroup
.
I agree with @sharwell that it looks like MSBuild is using the wrong engine version. I suspect that this is another symptom of https://github.com/dotnet/roslyn/issues/21583 / https://github.com/Microsoft/msbuild/issues/2369.
Actually, there's another possible explanation: @dpaoliello do you have binding redirects for Microsoft.Build assemblies in your app's .exe.config?
If not, is the behavior correct after adding:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Version Used: 2.3.1
Steps to Reproduce: Consider this csproj file:
When compiled with MSBuild, it correctly recognizes that there are no source files:
However, when attempting to load the same csproj via Roslyn's
MSBuildWorkspace
API:It reports an error:
Roslyn's
MSBuildWorkspace
API should be able to handleRemove
attributes.