Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic doc on msbuild and the gac #6173

Merged
merged 4 commits into from
Mar 23, 2021
Merged

Conversation

benvillalobos
Copy link
Member

Context

I'd like to have an easy link to send folks that have GAC issues with msbuild. aka.ms/msbuild/ungac should do the trick. There's no good place to point that link to, so here's a basic doc that should get folks unblocked if they really are seeing a GAC issue with MSBuild.

Changes Made

Added a doc.

Copy link
Member

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe also add a comment about other GAC-related issues we've had, since other assemblies in the GAC can mess with MSBuild. I'm particularly thinking of the System.Memory problem, but a variety of other assemblies we rely on could theoretically have the same problem.

It might also be worth emphasizing that putting something like MSBuild in the GAC seems like a solution because it makes problems go away, but it causes more problems down the road when you've forgotten you did that, and the next version comes out, and you get hard-to-understand version mismatch errors.


See the [public documentation](https://docs.microsoft.com/dotnet/framework/app-domains/gac). The GAC is a folder where different installations of VS on the same machine look for assemblies that are commonly used. If an assembly is in the GAC, it will be prioritized over any other assembly.

The only MSBuild assemblies you may see in the GAC are version 4.0. There is no reason any modern MSBuild assembly should be in the GAC today.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it version 4.8?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe define "modern" (15.0+)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, folders are marked as 4.0 but the assemblies themselves are 4.8.4

Run the [EnumerateMSBuild powershell script](https://github.com/Microsoft/msbuild/blob/master/scripts/EnumerateMSBuild.ps1) from our repo. It will output a `msbuild_versions.txt` file that lists MSBuild assemblies in their common folders along with their versions.

## How to Remove MSBuild Assemblies from the GAC
1. If on Visual Studio 16.8 or higher, repair your installation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like and, whereas I'm assuming you mean or.

@Forgind Forgind added the Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) label Feb 19, 2021
@benvillalobos
Copy link
Member Author

@Forgind Do you by chance have a link to a system.memory issue we've fixed by removing it from the GAC?

@Forgind
Copy link
Member

Forgind commented Mar 8, 2021

This took too long to find:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1249222

@benvillalobos
Copy link
Member Author

@Forgind Much appreciated. I posted it in our tracking issue. We can keep posting related assemblies there so we don't need to update this doc much.

Base automatically changed from master to main March 15, 2021 20:09
@benvillalobos benvillalobos merged commit bf0b0c5 into dotnet:main Mar 23, 2021
@benvillalobos benvillalobos deleted the ungac-doc branch March 23, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants