When I build a CONNECT C# example (e.g. ManagedToolsExample) from the SDK prompt, all is well. If I run openSln.bat to open Viz Studio from the same SDK shell then I see several errors similar to this...
...\SDK\examples\Elements\ManagedToolsExample\PlaceGroupedHoleTool.cs(72,25,72,38): error CS0115: 'PlaceGroupedHoleTool.OnPostInstall()': no suitable method found to override
I don't understand why that message occurs in Viz Studio, since it clearly inherits from DgnPrimitiveTool and builds successfully from the SDK prompt...
class PlaceGroupedHoleTool : DgnPrimitiveTool {}
Neither DgnPlatformNet nor MstnPlatformNet reveal any information about DgnPrimitiveTool!
Hi Jon,
I tried to compile the example you mentioned in Visual Studio 2015 Professional and no error or warning was reported.
But! I had to modify .cspoj file manually before I was able to compile the project. The problem was that NET target framework configuration was missing in the file, so at first I received a bunch of errors and warnings, because default version 4.0 was used automatically, which is in conflict with version 4.6.1 that was used to build referenced assemblies.
I added <TargetFrameworkVersion> node to ManagedToolsExample.csproj, so it looks now:
... <AssemblyName>ManagedToolsExample</AssemblyName> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup>
and the compilation from Visual Studio runs fine.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Jon Summers
Thanks, Jan! That fixed my problem.
I had tried to change the .NET Framework Version in the project properties, but that resulted in an incomprehensible error dialog.
Regards, Jon Summers LA Solutions
it's good to know the problem is solved :-)
Unknown said:but that resulted in an incomprehensible error dialog.
Yes, from some reasons to change the target framework is not possible, regardless it should work.
Unknown said:set TargetFrameworkVersion=v4.6.1
Thank, Bob! That worked OK.
I set it as a Windows environment variable and confirm that it shows up in my Viz Studio project properties.
Please note my comment in the first post about undocumented classes.
Hi Bob,
thanks for the confirmation and explanation of the situation!
Unknown said:I will try to identify a better/best practice to ensure proper and supportable compilation;
Well, I see pros and cons for both discussed options:
So ... what about a compromise solution to use conditional definition?
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.6.1</TargetFrameworkVersion>
If Visual Studio will be started independently, v4.6.1 will be used, but if started in environment where TargetFrameworkVersion variable is defined already, it will be used, so "target network alternatives" can be tested easily. On the other hand there are not many options where to go from 4.6.1, because 4.6.2 is not supported at Windows 8.0 and 4.7 is still quite new.
Unknown said:.NET 4.6.2 is not supported at Windows 8.0
Wikipedia and Microsoft tell us that .NET 4.6.x is available from Windows 7 SP1 and later, including 8.1. Are you being very precise when you write 8.0?
Unknown said:Are you being very precise when you write 8.0?
Yes, exactly :-)
.NET Framework 4.6.2 requires Windows 8.1, but if you have Windows 8.0, only 4.6.1 can be used.
This is minor condition, I don't know about any user that have stayed on 8.0 and did not migrate to 8.0, but because of this dependency, when you want to support "Windows 7 SP1 and newer", you should use 4.6.1 and not 4.6.2.