Skip to content

MVC6 - Accessing the internal classes from another assembly #783

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

Closed
Meikandan opened this issue Jul 31, 2015 · 4 comments
Closed

MVC6 - Accessing the internal classes from another assembly #783

Meikandan opened this issue Jul 31, 2015 · 4 comments

Comments

@Meikandan
Copy link

Hi,

We are trying to access the internal classes from one project to another. Earlier in other platforms we used the "InternalsVisibleTo" attributte to achieve this. Seems this is missing in MVC6.What is the equivalent for this attribute in MVC6.

Thanks,

Meikandan

@Eilon
Copy link
Contributor

Eilon commented Jul 31, 2015

InternalsVisibleTo works the exact same way as it always worked. Can you show what you tried and what doesn't work?

BTW it's not specific to MVC 6, it's a general .NET feature.

@Meikandan
Copy link
Author

Hi Eilon,
I am working with class libraries in MVC 6. Previously in other platforms I will specify this “InternalsVisibleTo” attribute in "AssemblyInfo.cs" class of the project which needs to be shared. But there is no AssemblyInfo.cs class in MVC 6 class libraries. So where should i specify this attribute?
Example:
AssemblyA -> AssemblyInfo.cs -> [assembly:System.Runtime.CompilerServices.InternalsVisibleTo("AssemblyB”)]
By specifying this in “AssemblyA” will give access to “AssemblyB” to access its internal classes and properties.
In MVC 6 class libraries there is no startup classes or entry classes like “AssembltInfo.cs”. So where should I specify this attribute. In MVC 6 only “project.jason” file is available.
Thanks,
Meikandan

@Eilon
Copy link
Contributor

Eilon commented Jul 31, 2015

@Meikandan it's the same thing. Just add an AssemblyInfo.cs file (you can copy an existing one you have) and put the same attributes in it. I logged a bug to add an AssemblyInfo.cs file to new projects to make this easier. But in the meantime just add the file yourself and it will work exactly the same way it did before.

@Meikandan
Copy link
Author

HI Eilon,

Adding the file myself got worked.

Thanks,
Meikandan

@Eilon Eilon closed this as completed Aug 4, 2015
natemcmaster pushed a commit that referenced this issue Nov 20, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants