14

I want to give developers using Visual Studio the ability to write programs against a custom framework that replaces .NET (similar to the Windows Phone and Silverlight frameworks, which are not subsets or profiles of an existing framework), and have full IntelliSense support and all.

Visual Studio 2010 supports multi-targeting, where you can target any framework (such as .NET, Silverlight, Robotics, XNA, Windows Phone and Mono) if you have the appropriate Targeting Packs installed.

I found that frameworks generally have some reference assemblies that they put in %programfiles%\Reference Assemblies\Microsoft\Framework along with a FrameworkList.xml file in the RedistList subfolder. I've tried just creating a new folder, putting my assemblies (e.g. MyFramework.dll) in there along with the RedistList subfolder containing a FrameworkList.xml file. I cleared the file but for one entry for similar to:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FileList Redist="MyFramework_1_0">
  <File AssemblyName="MyFramework" Version="1.0.0.0"
    PublicKeyToken="be3ea0d08db41157" Culture="neutral"
    ProcessorArchitecture="MSIL" InGAC="false" />
</FileList>

But Visual Studio doesn't list my framework in the list of available frameworks when creating a new project (after restarting VS). Obviously, I am missing something, but I haven't been able to figure out what.

How to create such a Targeting Pack that allows Visual Studio to see the custom framework, or something that has the same effect? What is generally included in a Targeting Pack? Can custom build steps be added?

Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
  • 8
    Are you really writing your own implementation of the framework? – Oded Nov 28 '11 at 11:51
  • 1
    Yup. For a custom system with a custom OS running a custom CLR implementation, I'm writing a custom framework. – Daniel A.A. Pelsmaeker Nov 28 '11 at 12:13
  • wow - is this going to be open source? – Adam Ralph Dec 19 '11 at 07:30
  • It will probably be open source. It is not meant to be a replacement for .NET or Mono, but rather a new framework with all the wrinkles of .NET ironed out. Everything the .NET designers would have like to have done differently, and everything I feel like doing better, will be part of the framework. This framework will then form the basis of the OS I'm trying to build for a long long time. – Daniel A.A. Pelsmaeker Dec 20 '11 at 01:12
  • Is your framework registered in the GAC? – Wilhelm Jan 16 '12 at 22:59
  • Initially I didn't add it to the GAC. But I've now strongly signed my assembly and put it in the GAC. Combined with the copy in the Reference Libraries folder and changes to the registry (as suggested on some sites, in the same key as suggested below by Simon Mourier), it still does not work. – Daniel A.A. Pelsmaeker Jan 17 '12 at 20:52
  • If you say a framework comparable to .Net is going to be the basis of your OS, does that mean you'll go in a direction similar to Singularity? – lesderid Jul 03 '12 at 07:02
  • That's correct, a C#-based OS. [Singularity](http://research.microsoft.com/en-us/projects/singularity/), [Cosmos](http://cosmos.codeplex.com/), [MOSA](http://www.mosa-project.org/) and [SharpOS](http://sharpos.sourceforge.net/) all do something similar. I may not be original, but it's surely a great learning experience and I have some original ideas to implement. – Daniel A.A. Pelsmaeker Jul 03 '12 at 15:23

2 Answers2

1

I think Visual Studio first looks in the registry, notably in this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework (or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework on 64-bit systems)

You'll find a bunch of interesting subkeys, some of them actually pointing to the program files\referenced assemblies folders.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • I've had a look and it didn't help me. Just adding keys in semi-random places in the register is neither substantiated nor did it work (I tried). Others have added frameworks or profiles (Microsoft, but also the Mono developers), so there must be people who can answer my question. – Daniel A.A. Pelsmaeker Nov 28 '11 at 21:58
  • Have you looked at the "Target Packs" section of this link http://msdn.microsoft.com/en-us/library/ee395432.aspx ? – Simon Mourier Nov 28 '11 at 22:30
  • As mentioned in the question, I did try what it says in the Target Packs section (adding reference assemblies and the FrameworkList.xml file), but since it doesn't make a difference, I must be missing something. – Daniel A.A. Pelsmaeker Nov 29 '11 at 15:24
  • @Virtlink - Did you attempt to modify the FrameworkList.xml by chance? – Security Hound Jan 06 '12 at 15:04
  • Yes I did. Please see the original post, I extended it. – Daniel A.A. Pelsmaeker Jan 06 '12 at 23:00
0

You are on the track. The problem is that the "New Project" dialog has a known limitation where it only lists .NET Framework-based frameworks.

Windows Phone, Silverlight and Portable all implement this on the template side. Basically, they have a template that pre-sets the TargetFrameworkIdentifier MSBuild property. For example, MyCustomFramework, where MyCustomFramework is the name of the framework under the Microsoft\Framework folder.

David Kean
  • 5,722
  • 26
  • 26