Introduction

You’ve just downloaded a project (from either codeproject or github or some other repository) – and opened it up in your current version of Visual Studio.

On trying to compile it, you encounter the following error:

AssemblyInfo.cs’ could not be opened (‘Unspecified error ‘)

This seems to occur for every project in your solution that contains an AssemblyInfo.cs. Simply put,  the assemblyinfo.cs contains ‘metadata’ (version number, guid etc.) for your assembly. This metadata is useful in uniquely identifying your assembly to all its consumers.

Workaround 1

Simply delete these assemblyinfo.cs files. If all you are trying to do is view sample source code, you do not really care about the versioning or COM interoperability (GUID) of the assembly. Your project should compile just fine after this deletion.

Workaround 2

If deleting the file is not an option – and you do need the metadata, simply delete the offending file – and create a new one. To create a new one, click on the ‘Properties’ folder in your project (see below). This should bring up the properties dialog. There should be an ‘Assembly Information’ button.

properties_assembly_info

Now, the only thing the assembly information really needs is a GUID. From your Tools menu—>CreateGUID as shown below.

createguid

 

Click ‘Copy’ on the CreateGUID popup – and paste that content into the Assembly Information screen from the previous step. Delete the leading slashes in the GUID, since you do not need those.

createguid1

Click OK – and you should be done. You will have an assemblyinfo with a GUID – and your project will compile just fine.

Summary

While uploading projects, the assemblyinfo.cs file often goes missing – and causes a compilation error for users who try downloading and compiling the project. The workaround is simple – either delete the file altogether (you don’t need it) – or delete and re-create it using the steps described in this post.

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.