Author Topic: Migrating From AutoCAD 2012 to 2013  (Read 11747 times)

0 Members and 1 Guest are viewing this topic.

CADbloke

  • Bull Frog
  • Posts: 337
  • Crash Test Dummy
Re: Migrating From AutoCAD 2012 to 2013
« Reply #15 on: June 27, 2012, 07:37:39 AM »
I have yet to try it but this might be handy for maintaining multiple projects using the same source code: http://msdn.microsoft.com/en-us/library/ff648745.aspx - Project Linker: Synchronization Tool on MSDN.

The Visual Studio Gallery page is at http://visualstudiogallery.msdn.microsoft.com/5e730577-d11c-4f2e-8e2b-cbb87f76c044 for downloading. I noticed in the Q&A that there may be an easy way to get it running in VS 2012 RC

This extension was made specifically for WPF / Silverlight project code sharing so things like XAML files may misbehave.

Caveat emptor !

... Edit ... This StackOverflow answer about modifying a project file to compile other sources using wildcards is also interesting (and more lightweight) http://stackoverflow.com/a/9563860/492

... Edit ... Thanks for clarifying Jeff. It was pretty late at night (for me) when I added that. :)
« Last Edit: June 27, 2012, 11:44:19 PM by CADbloke »

Jeff H

  • Needs a day job
  • Posts: 6117
Re: Migrating From AutoCAD 2012 to 2013
« Reply #16 on: June 27, 2012, 10:15:57 AM »

... Edit ... This StackOverflow answer about modifying a project file to compile other sources using wildcards is also interesting (and more lightweight) http://stackoverflow.com/a/9563860/492

'Add as Link' already mentioned in 2nd reply here, adds the same thing to the .csproj file.
 
 

CADbloke

  • Bull Frog
  • Posts: 337
  • Crash Test Dummy
Re: Migrating From AutoCAD 2012 to 2013
« Reply #17 on: July 02, 2012, 02:38:15 AM »
Firstly: I'm in the middle of trying this, so treat it as an incomplete work in progress.
'Add as Link' already mentioned in 2nd reply here, adds the same thing to the .csproj file.


The wildcards answer (http://stackoverflow.com/a/9563860/492)  I linked to previously automatically adds and removes all source files to/from the target project so you don't miss them. Note if you want to miss a specific file or more than you can name them using "Exclude". 

Code: [Select]
<ItemGroup>
    <Compile Include="..\_Src\**\*.cs" Exclude = "..\_Src\Properties\AssemblyInfo.cs">
      <Link>Src\%(RecursiveDir)%(Filename)%(Extension)</Link>
    </Compile>
   </ItemGroup>

This shows up in the target solution under a folder named "Src". To show the files in the root of the target project you just use ...

Code: [Select]
<ItemGroup>
    <Compile Include="..\_Src\**\*.cs" Exclude = "..\_Src\Properties\AssemblyInfo.cs">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
    </Compile>
   </ItemGroup>

More info on this at http://msdn.microsoft.com/en-us/library/ms164283(v=vs.90).aspx & http://msdn.microsoft.com/en-us/library/ms171453(v=vs.100).aspx & http://msdn.microsoft.com/en-us/library/ms171454(v=vs.100).aspx.

This works in both VS2012RC & VS2010sp1 although I had to close & re-open the solution in both for any file additions or deletions in the _Src project to propagate into the linked project(s).

I am creating projects for the various versions (generally milestone versions like 2006, 07, 10 & 13) which have the relevant references to their DLLs, and a separate project called "_Src", which has a reference to 2007 because it has the leanest feature set, for the actually source code that is used by all of the other projects when they build.

I don't want to build the _Src project. How do I stop that?:
  • Right-click the solution Root node in the Solution Explorer,
  • go to configuration properties -> Configuration.
  • Change the configuration dropdown (top left on VS2012) to "All Configurations",
  • then untick the build checkbox for the source project.


I am trying this in both VS2010sp1 & VS2012RC at the same time (different computers) and so far, so good. My real goal is to also share the _Src code with a stand-alone app using the ODA Teigha.NET (classic) library. Yeah, because my life is not already complicated enough.

There are various other things to watch for like target framework, x86/x64 (I got a build warning on v2007 for this but it usually doesn't matter AFAIK), changing method names (I'll use Tony's extension methods for this), a universale AssemblyInfo etc. I'll update as I crash into other things. As I said, it's a work in progress. Any input is most welcome.

cheers
Ewen


Update - this is the latest rendition of my XML to specify what is compiled in the project that references the source code:

Code: [Select]
  <ItemGroup>
    <!-- -->
    <!--This is where to include / exclude source code files-->
    <Compile Include="..\_Src\**\*.*" Exclude="..\_Src\Properties\AssemblyInfo.cs;..\_Src\bin\**\*.*;..\_Src\obj\**\*.*;..\_Src\**\*.csproj;..\_Src\**\*.user;..\_Src\**\*.vstemplate;..\_Src\readme.txt;..\_Src\**\*.lsp;..\_Src\**\*.scr">
      <Link>Src\%(RecursiveDir)%(Filename)%(Extension)</Link>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>

The source project has an AssemblyInfoForAllProjects.cs and each project has an AssemblyInfo.cs with just the AssemblyTitle, AssemblyDescription & COM GUID in it. The rest of the info, common to every project inthe solution, lives in AssemblyInfoForAllProjects.cs
« Last Edit: September 08, 2012, 09:20:12 AM by CADbloke »