简体   繁体   中英

How can I share XAML UserControls between VS projects?

I have a Portable Class Library project targeting Windows 8.1. The project has some normal C# files (template controls), and some XAML Page files (user controls).

When I build the project, I get the following in the bin/Release folder.

  • user_controls
    • example .xbf
  • Themes
    • Generic.xbf
  • project .dll
  • project .pdb
  • project .pri
  • project .xr.xml

These files are enough to deploy and run a test harness for the library in the same solution. I'd like to know how to package these files so that I can use them in other projects/solutions.

I found how to do this by trial and error. The package manager of choice for VS projects seems to be Nuget, for which the package file structure is as follows.

  • project
    • user_controls
      • example .xbf
    • Themes
      • Generic.xbf
    • project .xr.xml
  • project .dll
  • project .pdb
  • project .pri

The above goes in the lib folder. I'd be happy to here about a better (or less haphazard) way of doing this. But at least it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM