Build a NX Open .NET application

本文介绍如何使用Visual Studio IDE创建并发布NXOpen.NET应用程序。包括设置项目、添加引用、编写Main()函数、编译测试及签名流程。确保最终用户无需.NET授权许可即可使用。

A basic setup to build a NX Open .NET application using Visual Studio (IDE)

Interactive Application: .NET authoring license is required

Start Visual Studio 2003 (7.1)

Create class library project

  • File -> New -> Project -> Visual C# Projects (project types) -> Class Library

Add references

  • Project -> Add Reference…

Browse to UGII_BASE_DIR\UGII\managed\ Add the following files

  • NXOpen.dll
  • NXOpen.Utilities.dll
  • NXOpen.UF.dll
  • NXOpenUI.dll (only needed if you build an user interface for your application)

Add Main() function to the class

            public static void Main()       

           {

           }

Compile and build the application

Test Appilcation:

Launch NX

Run your sample application

  • File -> Execute -> NX/Open… (browse to your sample application \bin\Debug\ location, select your application.dll)

Sign Application:

In order to release an application and have non programers use this (someone without a .NET authoring license) you need to sign your application.

Add resource file NXSigningResource.res to your Visual Studio project

  • File -> Add Existing Item -> browse to UGII_BASE_DIR\UGOPEN\NXSigningResource.res

Set the NXSigningResource.res file Build Action to Embedded Resource

  • Properties on the NXSigningResource.res file that’s attached to your Visual Studio project

Sign the application, at a command prompt:

  • UGII_BASE_DIR\UGII\SignLibrary.exe yourSampleApplicationLocation\sampleApplication.dll

If you don’t sign your application when you release it to your end users, they will be required to have a “.NET authoring license”. This is very costly and unnecesary.

Set your Project Configuration Build to Release This will change the build arguments and remove the unnecessary debug statements for the released application

  • Build -> Configuration Manager
  • Set “Active Solution Configuration” to Release

Compile, Build, and test

Summary

This application does not do anything but it does set up the foundation needed to get an application built using the Visual Studio IDE and have it signed for release.

reference:

http://plmexchange.net/build-a-nx-open-net-application/#comment-713

### ### ASP.NET Web Application 的使用场景 ASP.NET Web Application 是一种用于构建动态网站、Web 应用程序和基于 HTTP 协议的服务端应用的开发模型。它适用于多种业务场景,尤其是在需要强大服务器端逻辑、复杂业务规则和丰富用户交互的 Web 项目中。 当需要构建企业级应用程序时,ASP.NET Web Application 提供了良好的架构支持,例如分层设计(如 MVC 模式)、依赖注入、强类型配置等特性,这使得大型项目更易于维护和扩展[^1]。此外,ASP.NET Web Application 支持完整的 .NET Framework 或 .NET Core/.NET 5+ 生态系统,开发者可以利用丰富的类库和工具链来实现高级功能,例如身份验证、缓存机制、分布式处理等。 在中小型 Web 项目中,如果希望获得更好的编译时检查、命名空间管理以及统一的项目结构,ASP.NET Web Application 也是首选方案。与传统的 ASP.NET Web Site 不同,Web Application 项目将所有代码预编译为一个或多个 DLL 文件,从而提升运行效率并增强安全性[^2]。 对于需要部署到 IIS 上的传统 Web 应用,或者需要通过 Visual Studio 进行集中管理和调试的项目,ASP.NET Web Application 提供了标准的项目文件(`.csproj` 或 `.vbproj`),便于版本控制、自动化构建和持续集成流程集成。 在现代开发中,随着 ASP.NET Core 的普及,WebApplication 类成为创建 Web 应用的标准方式,尤其适用于跨平台部署、高性能 API 服务以及容器化微服务架构。ASP.NET Core 中的 WebApplication 类简化了主机配置和中间件注册流程,使得开发人员能够快速搭建可维护的 Web 应用程序[^3]。 ```csharp var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/", () => "Hello World!"); app.Run(); ``` 因此,在以下几种典型场景中应优先考虑使用 ASP.NET Web Application: - 需要完整的项目结构和编译控制的企业级 Web 应用开发; - 希望利用强类型配置、命名空间管理和模块化设计的中大型项目; - 使用 IIS 托管的传统 Web 应用,并需要通过 Visual Studio 进行集中调试与部署; - 构建高性能、可跨平台运行的 Web API 或 MVC 应用,尤其是采用 ASP.NET Core 的现代化开发模式。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值