C# UWP - Can't add reference to project in same solution

坚强是说给别人听的谎言 提交于 2019-12-05 02:29:29

You should create a portable class library for your API utility.

See MSDN: https://msdn.microsoft.com/en-us/library/gg597391(v=vs.110).aspx

When coding UWP , to build library that can be referenced by a same-solution UI UWP project I need to use a specific library project template (e.g.: by doing Add new Project | Windows | Class Library (Universal Windows)) , that's what worked for me ( I assume you have UWP SDK installed ) so if you have your .dll source maybe you should try to recompile it using that project format. Hope it helps.

There are two ways to provide reference to c# projects.

Select project -> Right click References -> Add reference
1. via .dll : Browse for Assemblies(.dll files) and select your desired file -> OK
2. via .csproj : Select Projects/Shared Projects from left menu -> browse for the .csproj files (Note: choose file-filter as 'All files' to make them visible) -> OK

When adding the Test Project, instead of going to "Test" and selecting "Unit Test Project (.Net Framework)"… Go to "Windows Universal" and select "Unit Test App (Universal Windows)"

If you select this project, then you will be able to add a reference to your UWP project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!