msbuild
msbuild copied to clipboard
Msbuild doesn't generate assemblyBinding if run multi-target (restore;build) at same command for first time
Scenerio:
- I created project call
FooProgramis windows form with localization support and use new-style csproj. And I reference toSystem.Resources.Extensionsand configure<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources> - Then I create another program call
ClientAppProgramreference toFooProgram. - Both 2 application configure with target framework is net472.
Issue Description
- If I use Visual Studio build both 2 projects. Not problem. The
assemblyBindingare generated and append to.exe.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Resources.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Then I try to remove all folder bin and obj then using command msbuild to build for first shot and got issue
dotnet msbuild ClientAppProgram.csproj -t:Restore;Build
I check output in bin of ClientAppProgram and found missing generate assemblyBinding for ClientAppProgram but FooProgram has. But IF I clean all folder bin and obj then i try separate into 2 commands
dotnet msbuild ClientAppProgram.csproj -t:Restore
dotnet msbuild ClientAppProgram.csproj -t:Build
Then the assemblyBinding are generated for both appliation or I try rerun again command above still generated. So it's strange that why the assemblyBinding never generate for 1 build command at first time.
Steps to Reproduce
- Run command
dotnet msbuild ClientAppProgram.csproj -t:Restore;Buildto build ClientAppProgram then to to bin/debug/net472 to verifyClientAppProgram.exe.configmust has assemblyBinding
Expected Behavior
assemblyBindingmust generate for both mulit-target command: restore;build; forClientAppProgram.exe.config
Actual Behavior
assemblyBindingonly generate if run 2 target in 2 separate command. so if run 1 command cause missing
Versions & Configurations
- I try both
dotnet msbuildandmsbuildfrom visual studio and got same issue.
Program to verify: FooProgram.zip
Team Triage: Does this issue repro if you do msbuild /restore /t:Build?
This issue is marked as stale because feedback has been requested for 30 days with no response. Please respond within 14 days or this issue will be closed due to inactivity.
This issue was closed due to inactivity. If you can still reproduce this bug, please comment with the requested information, detailed steps to reproduce the problem, or any other notes that might help in the investigation.