What’s the ‘correct’ way of registering/installing an Assembly to the GAC?

With Wix I would do something like this: <DirectoryRef Id=”MyDirectory” > <Component Id=”MyComponent” Guid=”PUT-GUID-HERE” DiskId=”1″> <File Id=”MyAssembly” Name=”MyAssembly.dll” Assembly=”.net” KeyPath=”yes” Source=”MyAssembly.dll” /> </Component> </DirectoryRef> When you use the attribute Assembly=”.net” for a file in WiX, it will create entries in the MsiAssembly and MsiAssemblyName table for this component and mark it as a GAC component.

Use Visual Studio Setup Project to automatically register and GAC a COM Interop DLL

Gacutil.exe won’t be available on the target machine. Not a problem, MSI can get the job done. Right-click “File System on Target Machine”, Add, GAC. Right-click that added folder, Add, Project Output. That ensures the assembly is gac-ed. It can also register the assembly like Regasm.exe does. Set the Register property of the project output … Read more

Error message “Unable to install or run the application. The application requires stdole Version 7.0.3300.0 in the GAC”

Try going to the Publish tab in the project properties and then select the Application Files button. Then set the following properties: File Name of stdole.dll Publish status to Include Download Group to Required After that you need to republish your application. If the reference has CopyLocal=true, then the reference will be published with the … Read more

What is the GAC in .NET?

Right, so basically it’s a way to keep DLLs globally accessible without worrying about conflicts. No more DLL Hell. Each architecture and version gets it’s own place to live. It also gets it own way to browse it in Explorer, so if you go to C:\Windows\assembly In windows explorer it lists all the DLLs. But … Read more

How can I force .NET to use a local copy of an assembly that’s in the GAC

Make sure the GAC Assembly and local Assembly have different version numbers (not a bad idea to let your build number, at least, auto-increment by wild-carding your AssemblyVersion in AssemblyInfo: [assembly: AssemblyVersion(“1.0.0.*”)] ). Then, redirect your assembly binding using your app’s config: http://msdn.microsoft.com/en-us/library/2fc472t2(VS.80).aspx http://msdn.microsoft.com/en-us/library/433ysdt1(VS.80).aspx. In your case, you won’t need the “appliesTo” attribute of the … Read more

Is there any GAC equivalent for .NET Core?

Edit 2017-09-01 Somewhat analogous to the GAC, .NET Core 2.0 introduces the “Runtime package store“: Starting with .NET Core 2.0, it’s possible to package and deploy apps against a known set of packages that exist in the target environment. The benefits are faster deployments, lower disk space use, and improved startup performance in some cases. … Read more

The name ‘ViewBag’ does not exist in the current context

I was having the same problem. Turned out I was missing the ./Views/Web.config file, because I created the project from an empty ASP.NET application instead of using an ASP.NET MVC template. For ASP.NET MVC 5, a vanilla ./Views/Web.config file contains the following: <?xml version=”1.0″?> <!– https://stackoverflow.com/a/19899269/178082 –> <configuration> <configSections> <sectionGroup name=”system.web.webPages.razor” type=”System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, … Read more

What are the advantages and disadvantages of using the GAC?

Loading assemblies from GAC mean less overhead and security that your application will always load correct version of .NET library You shouldn’t ngen assemblies that are outside of GAC, because there will be almost no performance gain, in many cases even loss in performance. You’re already using GAC, because all standard .NET assemblies are actually … Read more