Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelDocExtension conflict #33

Open
codestackdev opened this issue Oct 21, 2019 · 0 comments
Open

ModelDocExtension conflict #33

codestackdev opened this issue Oct 21, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@codestackdev
Copy link
Owner

codestackdev commented Oct 21, 2019

The following compile error is displayed when ModelDocExtension class is used explicitly:

error CS0433: The type 'ModelDocExtension' exists in both 'CodeStack.SwEx.AddIn, Version=0.8.1.0, Culture=neutral, PublicKeyToken=a46023996d4724e7' and 'SolidWorks.Interop.sldworks, Version=27.1.0.72, Culture=neutral, PublicKeyToken=7c4797c3e4eeac03'

ModelDocExtension modelDocExt2 = model.Extension;
var appPageSetup4 = modelDocExt2.AppPageSetup;

This only happens if variable of type ModelDocExtension is declared explicitly.

The are several workarounds available:

  1. Use IModelDocExtension instead of ModelDocExtension
IModelDocExtension modelDocExt1 = model.Extension;
var appPageSetup3 = modelDocExt1.AppPageSetup;
  1. Use var in C# to avoid explicit declaration
var modelDocExt = model.Extension;
var appPageSetup2 = modelDocExt.AppPageSetup;
  1. Do not declare the variable, but use Extension property of IModelDoc2
var appPageSetup1 = model.Extension.AppPageSetup;
@codestackdev codestackdev added the bug Something isn't working label Oct 21, 2019
@codestackdev codestackdev self-assigned this Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant