MSBuild更新来源咨询:VS2017不同版本生成安装包的DLL版本差异
Troubleshooting Your WPF/WIX Build & MSBuild Questions
Hey there, let's work through your two main issues and questions step by step:
1. Why does the netstandard.dll version differ between your MSI packages?
The version mismatch makes total sense given your setup—here's why and how to align things:
- VS 2017 minor version gaps: VS 2017 15.6.6 is a newer patch release than 15.6.4. Each minor VS update ships with updated SDKs, tooling, and core reference libraries (including
netstandard.dll) that are tied directly to the VS installation. Even if you both have the fully updated .NET Framework, VS itself prioritizes its own bundled standard library references during builds. - Unlocked dependency versions: If your project doesn't explicitly lock the version of
netstandardbeing used, VS will pull the version included in its local installation directory. To fix this, check your project files (.csproj) and add an explicit version lock:
If using NuGet, ensure your<Reference Include="netstandard"> <Version>4.6.25908.2</Version> <!-- Or the version you want to standardize on --> </Reference>PackageReferencefor netstandard-related packages has a fixed version instead of a floating range. - NuGet cache inconsistencies: Local NuGet caches might hold different versions of the library. Try clearing the cache on both machines:
- Run
dotnet nuget locals all --clearin a command prompt - Or in VS, go to Tools > NuGet Package Manager > Package Manager Settings > Clear All NuGet Cache(s)
- Run
- WIX reference path differences: Double-check your WIX project to confirm it's pulling
netstandard.dllfrom a consistent shared location (like your project's output directory or a centralized NuGet package folder) rather than a VS-specific system path.
2. Where does MSBuild get updated from?
MSBuild updates come from two primary sources in your VS 2017 environment:
- Visual Studio Updates: MSBuild is bundled directly with Visual Studio. When you run the Visual Studio Installer and apply updates (like moving from 15.6.4 to 15.6.6), it automatically updates the MSBuild version included in your VS installation (typically located at
C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\MSBuild). - Standalone .NET SDK Installations: If you've installed separate .NET SDKs (like .NET Core SDKs), they include their own version of MSBuild. However, when building within VS 2017, it will prioritize the MSBuild version that came with your VS installation by default.
To confirm your current MSBuild version, open the Developer Command Prompt for VS 2017 and run:
msbuild -version
Compare this output with your colleague's to see the direct link between your VS patch levels and MSBuild versions.
Quick Recommendations
- Standardize on the same VS 2017 minor version (upgrade both to 15.6.6) to eliminate environment-based build discrepancies entirely.
- Lock all dependency versions in your project files to guarantee consistent builds across any machine.
内容的提问来源于stack exchange,提问作者G.Dealmeida
相关产品推荐
相关产品推荐

