modelsbuilder / ModelsBuilder.Original

The Community Models Builder for Umbraco
MIT License
114 stars 49 forks source link

Panic when generating classes outside of the current project #48

Closed ryanlewis closed 9 years ago

ryanlewis commented 9 years ago

Using the Visual Studio extension.

Get panic error (listed below) if the project selected in Solution Explorer is different to the one containing your ModelsBuilder.cs (file with custom tool configured).

  1. Have models in Site.Core, Umbraco in Site.Web
  2. Open ModelsBuilder.cs (with custom tool configured)
  3. Select the Site.Web project in Solution Explorer
  4. Click on text editor for ModelsBuilder.cs, save file

Get the following error

ZbuModelsBuilder: Starting v2.1.1.38 15/04/2015 16:44:59.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Panic: source file not found in project.
ZbuModelsBuilder:    at Zbu.ModelsBuilder.CustomTool.VisualStudio.VisualStudioHelper.GetSourceItem(String inputFilePath)
   at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

My actual workflow is this, using Resharper:

  1. Open ModelsBuilder.cs with Resharper "Navigate To"
  2. Save file
  3. Get "Panic" error

To work around the issue, I have to ensure that the "current project" (in Solution Explorer) is my Core project, then save/run custom tool (I use shift+alt+L, ESC as a nifty shortcut to do this)

zpqrtbnk commented 9 years ago

Weird - those "panic" errors are things that are not supposed to happen ;-) But I see what's happening, will look for a fix.

zpqrtbnk commented 9 years ago

Pushed a fix, will test & build 2.1.2 soon as I can find some time.

zpqrtbnk commented 9 years ago

Should be fixed in 2.1.2.