### Example package.json Dependencies Configuration Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/nodejs-vscode/setup/project.mdx Illustrates the expected `dependencies` section within the `package.json` file after installing all required Node.js and APS SDK packages. Version numbers may vary slightly depending on the exact package versions installed. ```json { "dependencies": { "@aps_sdk/authentication": "^1.0.0", "@aps_sdk/autodesk-sdkmanager": "^1.0.0", "@aps_sdk/construction-account-admin": "^1.1.0", "@aps_sdk/construction-issues": "^1.1.0", "@aps_sdk/data-management": "^1.0.2", "cookie-session": "^2.1.0", "dotenv": "^16.4.5", "express": "^5.1.0" } } ``` -------------------------------- ### Add Start Script to package.json Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/nodejs-vscode/setup/server.mdx Adds a 'start' script to the 'scripts' section of the 'package.json' file. This allows the application to be easily run from the command line using 'npm start', which executes 'node server.js'. ```json "scripts": { "start": "node server.js" } ``` -------------------------------- ### Configure npm Start Script in package.json Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/nodejs-vscode/setup/server.mdx This JSON snippet adds a 'start' script to the 'scripts' section of your package.json. This allows you to easily run your Node.js application by executing 'npm start' from the command line, which in turn runs 'node server.js'. ```json "scripts": { "start": "node server.js" } ``` -------------------------------- ### Setup Simple Viewer Application Locally Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/03-dashboard/01-basic.mdx Provides instructions for setting up the APS Simple Viewer application locally using either Node.js or .NET 8. This involves cloning the repository, installing dependencies, and running the application with your APS client ID and secret. The application will then be accessible via a web browser. ```bash git clone https://github.com/autodesk-platform-services/aps-simple-viewer-nodejs cd aps-simple-viewer-nodejs npm install APS_CLIENT_ID="your client id" APS_CLIENT_SECRET="your client secret" npm start ``` ```bash git clone https://github.com/autodesk-platform-services/aps-simple-viewer-dotnet cd aps-simple-viewer-dotnet dotnet build APS_CLIENT_ID="your client id" APS_CLIENT_SECRET="your client secret" dotnet run ``` -------------------------------- ### Configure .NET Web Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/dotnet-vs2022/setup/server.mdx This C# code defines the entry point for a .NET web application, configuring the web host to use the `Startup` class for application setup. It ensures the application creates and runs a web server, which is essential for handling web requests. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Starting an Express Server with Socket.IO Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/nodejs-vscode/setup/server.mdx This JavaScript file initializes and starts the Express server, integrating it with Socket.IO. It listens on a specified port and includes error handling for port conflicts, ensuring the server starts correctly and logs its status. ```JavaScript const app = require("./server"); const socketIO = require("./socket.io")(app); let server = socketIO.http.listen(app.get("port"), () => { console.log(`Server listening on port ${app.get("port")}`); }); server.on("error", (err) => { if (err.errno === "EACCES") { console.error(`Port ${app.get("port")} already in use.\nExiting...`); process.exit(1); } }); ``` -------------------------------- ### Verify Node.js Project Dependencies in package.json Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/nodejs-vscode/setup/project.mdx After installing all required packages, the "dependencies" section of your `package.json` file should reflect the installed modules. This snippet provides an example of the expected entries, ensuring all necessary libraries are correctly listed for the Autodesk Platform Services tutorial project. ```json // ... "dependencies": { "@aps_sdk/authentication": "^1.0.0", "@aps_sdk/autodesk-sdkmanager": "^1.0.0", "@aps_sdk/data-management": "^1.0.0", "@aps_sdk/construction-account-admin": "^1.0.0", "cookie-session": "^2.1.0", "dotenv": "^16.4.5", "express": "^4.19.2" } // ... ``` -------------------------------- ### Verify .NET Runtime Installation Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/02-setup/_shared/dotnet-vscode/setup.mdx This command checks the installed version of the .NET runtime to ensure it is available and correctly configured on your system. It is used to confirm that the required .NET 8.0 runtime is present for running sample applications. ```bash dotnet --version ``` -------------------------------- ### ASP.NET Core Project File Configuration (.csproj) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vscode/setup/project.mdx This XML snippet illustrates the typical structure of an ASP.NET Core project file (.csproj), showing the target framework and the included PackageReference entries for the installed Autodesk Platform Services SDKs and Microsoft.AspNetCore.Mvc.NewtonsoftJson. ```xml net8.0 ``` -------------------------------- ### ASP.NET Core Project File Configuration (.csproj) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vscode/setup/project.mdx This XML snippet shows the typical structure of an ASP.NET Core project file after installing the APS SDK dependencies. It defines the target framework, language features, and lists all installed NuGet package references with their versions. ```xml net9.0 enable enable aps_acc_issues_dotnet_vscode ``` -------------------------------- ### Initialize ASP.NET Core Web Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vscode/setup/project.mdx This command initializes a new ASP.NET Core web project in the current directory, setting up the basic file structure for a web application. ```bash dotnet new web ``` -------------------------------- ### Add Start Script to package.json (Node.js) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/nodejs-vscode/setup/server.mdx This snippet demonstrates how to add a 'start' script to the 'scripts' section of a 'package.json' file, allowing the application to be easily run using 'npm start' by executing 'node server.js'. ```json // ... "scripts": { "start": "node server.js" } // ... ``` -------------------------------- ### Configure .NET Web Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vscode/setup/server.mdx This C# code snippet for `Program.cs` ensures that the .NET application correctly creates and runs a web server, utilizing a custom `Startup` class for application configuration. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Verify Node.js and NPM Installation in Bash Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/02-setup/_shared/nodejs-vscode/setup.mdx This snippet shows how to check the installed versions of Node.js and NPM using the command line. It helps confirm that both tools are correctly set up and accessible in your system's PATH. ```bash node -v npm -v ``` -------------------------------- ### Install Node.js Dependencies for APS Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/nodejs-vscode/setup/project.mdx Installs required Node.js packages including `dotenv` for environment variables, `express` for the web framework, `express-formidable` for handling multipart form data, and the official Autodesk Platform Services (APS) SDK packages for authentication, model derivative, and OSS. ```bash npm install --save dotenv express express-formidable ``` ```bash npm install --save @aps_sdk/authentication @aps_sdk/model-derivative @aps_sdk/oss ``` -------------------------------- ### Initialize ASP.NET Core Web Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/dotnet-vscode/setup/project.mdx This command initializes a new ASP.NET Core web application project in the current directory. It sets up the basic project structure and necessary files for a web application. ```bash dotnet new web ``` -------------------------------- ### Initialize ASP.NET Core Web Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vscode/setup/project.mdx This command initializes a new ASP.NET Core web project in the current directory. It sets up the basic file structure required for a web application. ```bash dotnet new web ``` -------------------------------- ### Install Autodesk Platform Services SDK Packages Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vscode/setup/project.mdx These commands add the necessary Autodesk Platform Services (APS) SDK packages and a JSON serializer package to your ASP.NET Core project. These packages provide APIs for authentication, data management, and construction services. ```bash dotnet add package Autodesk.Authentication dotnet add package Autodesk.DataManagement dotnet add package Autodesk.Construction.AccountAdmin dotnet add package Autodesk.Construction.Issues dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson ``` -------------------------------- ### Initialize Node.js Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/nodejs-vscode/setup/project.mdx Initializes a new Node.js project in the current directory, creating a default package.json file with basic project metadata. ```bash npm init -y ``` -------------------------------- ### Add Start Script to package.json for Node.js Application Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/nodejs-vscode/setup/server.mdx This JSON snippet demonstrates how to add a 'start' script within the 'scripts' section of a 'package.json' file. This configuration allows developers to easily launch the Node.js application by running 'npm start', which executes the 'server.js' file. ```json // ... "scripts": { "start": "node server.js" } // ... ``` -------------------------------- ### Install Autodesk Platform Services SDK Dependencies Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vscode/setup/project.mdx These commands add the necessary Autodesk Platform Services (APS) SDK packages for authentication, construction account administration, data management, and the SDK manager, along with Microsoft.AspNetCore.Mvc.NewtonsoftJson for JSON serialization, to the ASP.NET Core project. ```bash dotnet add package Autodesk.Authentication dotnet add package Autodesk.Construction.AccountAdmin dotnet add package Autodesk.DataManagement dotnet add package Autodesk.SDKManager dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 8.0.5 ``` -------------------------------- ### Install Autodesk Platform Services SDK Packages Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/dotnet-vscode/setup/project.mdx These commands add the required Autodesk Platform Services (APS) SDK packages (Autodesk.Authentication, Autodesk.ModelDerivative, and Autodesk.OSS) to the ASP.NET Core project. These packages provide functionalities for authentication, model derivative services, and object storage services, respectively. ```bash dotnet add package Autodesk.Authentication dotnet add package Autodesk.ModelDerivative dotnet add package Autodesk.OSS ``` -------------------------------- ### Initialize Node.js Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/nodejs-vscode/setup/project.mdx Initializes a new Node.js project in the current directory, creating a `package.json` file with default values. The `-y` flag skips the interactive prompt. ```bash npm init -y ``` -------------------------------- ### Start local development server Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/README.md Starts a local development server and opens a browser window for live debugging. Most changes are reflected live without requiring a server restart. ```Shell $ npm run start ``` -------------------------------- ### Install Core and APS SDK Node.js Dependencies Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/nodejs-vscode/setup/project.mdx Install necessary Node.js packages for the project. This includes `dotenv` for environment variables, `express` for the web framework, `cookie-session` for session management, and the core Autodesk Platform Services (APS) SDKs for authentication, data management, and construction account administration. ```bash npm install --save dotenv express cookie-session npm install --save @aps_sdk/autodesk-sdkmanager @aps_sdk/authentication @aps_sdk/data-management @aps_sdk/construction-account-admin ``` -------------------------------- ### Install Node.js and APS SDK Dependencies Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/nodejs-vscode/setup/project.mdx Installs core Node.js dependencies like `dotenv`, `express`, and `cookie-session`, along with various Autodesk Platform Services (APS) SDK packages required for the tutorial. The `--save` flag adds these packages to the `dependencies` section of `package.json`. ```bash npm install --save dotenv express cookie-session npm install --save @aps_sdk/autodesk-sdkmanager @aps_sdk/authentication @aps_sdk/data-management @aps_sdk/construction-account-admin @aps_sdk/construction-issues ``` -------------------------------- ### Verify Node.js Project Dependencies in package.json Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/nodejs-vscode/setup/project.mdx Shows the expected 'dependencies' section within the package.json file, confirming that all required modules for an Autodesk Platform Services (APS) project have been successfully added. ```json { "dependencies": { "@aps_sdk/authentication": "^1.0.0", "@aps_sdk/data-management": "^1.0.0", "cookie-session": "^1.4.0", "dotenv": "^16.3.1", "express": "^4.18.2" } } ``` -------------------------------- ### Initialize APS SDK Clients in Node.js Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/nodejs-vscode/admin/admin-sdk.mdx Adds the `@aps_sdk/construction-account-admin` library and initializes an `AdminClient` instance along with other APS SDK clients in the `services/aps.js` file. This setup is crucial for interacting with various APS services. ```js const { SdkManagerBuilder } = require('@aps_sdk/autodesk-sdkmanager'); const { AuthenticationClient, Scopes, ResponseType } = require('@aps_sdk/authentication'); const { DataManagementClient } = require('@aps_sdk/data-management'); const { IssueClient } = require('@aps_sdk/construction-issues'); // highlight-start const { AdminClient } = require('@aps_sdk/construction-account-admin'); // highlight-end const { APS_CLIENT_ID, APS_CLIENT_SECRET, APS_CALLBACK_URL, INTERNAL_TOKEN_SCOPES, PUBLIC_TOKEN_SCOPES } = require('../config.js'); const service = module.exports = {}; const sdk = SdkManagerBuilder.create().build(); const authenticationClient = new AuthenticationClient(sdk); const dataManagementClient = new DataManagementClient(sdk); const issueClient = new IssueClient(sdk); // highlight-start const adminClient = new AdminClient(sdk); // highlight-end ``` -------------------------------- ### Configure .NET Web Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vscode/setup/server.mdx This C# code defines the entry point for a .NET web application, configuring it to use a web server with a `Startup` class. It sets up the host to listen for incoming requests, ensuring the application can serve web content. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Configure .NET Web Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vs2022/setup/server.mdx This C# code defines the entry point for a .NET web application, configuring the web host to use the `Startup` class. It ensures the application creates and runs a web server, which is essential for the APS tutorial. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Configure ASP.NET Core Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/dotnet-vs2022/setup/server.mdx This C# code defines the entry point for an ASP.NET Core application, setting up the web host to use the `Startup` class for configuration. It initializes the server that will handle incoming requests, preparing the application for execution. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Install Node.js Dependencies for APS Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/nodejs-vscode/setup/project.mdx Installs core Node.js dependencies such as dotenv for environment variables, Express.js for the web framework, cookie-session for session management, and the required Autodesk Platform Services (APS) SDK modules for authentication and data management. ```bash npm install --save dotenv express cookie-session npm install --save @aps_sdk/authentication @aps_sdk/data-management ``` -------------------------------- ### VS Code Launch Configuration for Node.js Server Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/nodejs-vscode/setup/config.mdx This launch.json configuration for Visual Studio Code defines a 'Launch Server' debug profile. It's set up to start the Node.js application by executing the npm start command, enabling easy debugging and execution directly from the IDE. ```json { "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Server", "runtimeExecutable": "npm", "runtimeArgs": [ "start" ], "skipFiles": [ "/**/*.js" ] } ] } ``` -------------------------------- ### Initialize Node.js Project with npm Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/nodejs-vscode/setup/project.mdx Use `npm init -y` to quickly create a new `package.json` file with default settings, marking the current directory as a Node.js project. This is the first step in setting up any Node.js application. ```bash npm init -y ``` -------------------------------- ### Verify Project Dependencies in package.json Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/nodejs-vscode/setup/project.mdx Shows the expected `dependencies` section within the `package.json` file after installing all necessary Node.js packages. This confirms that the APS SDK, Express.js, dotenv, and express-formidable are correctly listed with their respective versions. ```json // ... "dependencies": { "@aps_sdk/authentication": "^1.0.0", "@aps_sdk/model-derivative": "^1.0.0", "@aps_sdk/oss": "^1.0.1", "dotenv": "^16.4.1", "express": "^4.18.2", "express-formidable": "^1.2.0" }, // ... ``` -------------------------------- ### Configure Startup.cs for Static Files, MVC, and SignalR Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/dotnet-vs2022/setup/server.mdx Configures the `Startup` class to enable static file serving for HTML and JavaScript, sets up MVC routing, and integrates SignalR for real-time client notifications. It also addresses JSON serialization settings for SignalR to prevent reference loop issues. ```C# // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => options.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_3_0).AddNewtonsoftJson(); services.AddSignalR().AddNewtonsoftJsonProtocol(opt=> { opt.PayloadSerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseFileServer(); app.UseMvc(); } ``` -------------------------------- ### Install Autodesk Platform Services SDK Packages Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/dotnet-vscode/setup/project.mdx Add the `Autodesk.Authentication` and `Autodesk.DataManagement` NuGet packages to your ASP.NET Core project. These packages provide the necessary SDKs to interact with Autodesk Platform Services APIs for authentication and data management. ```bash dotnet add package Autodesk.Authentication dotnet add package Autodesk.DataManagement ``` -------------------------------- ### Automate 3ds Max Plugin Packaging with Post-Build Event Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/_plugins/max-plugin.mdx This command-line script, configured as a post-build event, automates the packaging process. It copies the compiled DLL into the .bundle/Contents folder, removes any existing ZIP archive, and then uses 7-Zip to create a new ZIP of the .bundle folder, placing it in the web application's bundles directory for deployment. ```CommandLine xcopy /Y /F "$(TargetDir)*.dll" "$(ProjectDir)UpdateMAXParam.bundle\Contents\" del /F "$(ProjectDir)..\designAutomationSample\wwwroot\bundles\UpdateMAXParam.zip" "C:\Program Files\7-Zip\7z.exe" a -tzip "$(ProjectDir)../designAutomationSample/wwwroot/bundles/UpdateMAXParam.zip" "$(ProjectDir)UpdateMAXParam.bundle\" -xr0!*.pdb ``` -------------------------------- ### Initialize .NET Design Automation Project with Bash Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/dotnet-vscode/setup/project.mdx This script automates the setup of a new .NET web project for Autodesk Design Automation. It verifies the .NET SDK version, creates a new web application, navigates into the project directory, and adds essential Autodesk Forge and NewtonsoftJson NuGet packages, finally building the project and opening it in VS Code. ```bash dotnet --version dotnet new web -n designAutomationSample cd designAutomationSample dotnet add package Autodesk.Forge --version 1.9.7 dotnet add package Autodesk.Forge.DesignAutomation --version 5.1.0 dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 6.0.11 dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 6.0.11 dotnet add package Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson --version 6.0.11 dotnet build code . ``` -------------------------------- ### Configure .NET Web Server with Startup Class (C#) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/dotnet-vscode/setup/server.mdx This C# code snippet for `Program.cs` configures the .NET application to create a web server. It uses `CreateHostBuilder` to set up the default host and integrate the `Startup` class, which is essential for defining the application's request processing pipeline. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Initialize Node.js Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/nodejs-vscode/setup/project.mdx This command initializes a new Node.js project in the current directory, creating a `package.json` file with default values. The `-y` flag skips the interactive prompt, accepting all defaults. ```bash npm init -y ``` -------------------------------- ### Verify .csproj File for APS SDK Package References Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/dotnet-vscode/setup/project.mdx This XML snippet shows the expected content of the .csproj file after installing the Autodesk Platform Services (APS) SDK packages. It confirms that the Autodesk.Authentication, Autodesk.ModelDerivative, and Autodesk.OSS package references are correctly added under the ItemGroup section, targeting .NET 8.0. ```xml net8.0 ``` -------------------------------- ### Execute MAXScript Locally with 3ds Max Batch Tool Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/_plugins/max-plugin.mdx This command-line example illustrates how to use '3dsmaxbatch.exe' for local testing of Design Automation functionality. It executes a specified MAXScript file ('da_script.ms') on a given 3ds Max scene file ('.max'), simulating the behavior of the 3ds Max Design Automation engine. ```CommandLine "%ADSK_3DSMAX_x64_2019%\3dsmaxbatch.exe" -sceneFile .max da_script.ms ``` -------------------------------- ### Verify Git Installation in Bash Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/02-setup/_shared/git.mdx This command is used to check if Git is installed on your system and to display its current version. Running this command in your bash terminal will confirm Git's availability and readiness for use. ```bash git --version ``` -------------------------------- ### Initialize ASP.NET Core Web Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/02-hubs-browser/_shared/dotnet-vscode/setup/project.mdx Use the `dotnet new web` command to create a new ASP.NET Core web application project. This command sets up the basic file structure and necessary configuration for a web application. ```bash dotnet new web ``` -------------------------------- ### C# APS Data Management: Get Hubs and Projects Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet/data/hubs.mdx This C# code defines methods within a partial APS class to interact with the Autodesk Data Management API. The GetHubs method retrieves all hubs and filters them to include only those with IDs starting with 'b.'. The GetProjects method fetches projects for a given hub ID and filters them to include only 'ACC' project types. ```C# using System.Collections.Generic; using System.Threading.Tasks; using Autodesk.DataManagement; using Autodesk.DataManagement.Model; using System; using System.Linq; public partial class APS { public async Task> GetHubs(Tokens tokens) { DataManagementClient dataManagementClient = new DataManagementClient(_SDKManager); var getHubs = await dataManagementClient.GetHubsAsync(accessToken: tokens.AccessToken); var hubsData = getHubs.Data.Where(hub => hub.Id.StartsWith("b.")); return hubsData; } public async Task> GetProjects(string hubId, Tokens tokens) { DataManagementClient dataManagementClient = new DataManagementClient(_SDKManager); var hubProjects = await dataManagementClient.GetHubProjectsAsync(hubId: hubId, accessToken: tokens.AccessToken); return hubProjects.Data .Where(project => project.Attributes.Extension.Data.TryGetValue("projectType", out var projectType) && projectType?.ToString() == "ACC") .ToList(); } } ``` -------------------------------- ### Install project dependencies Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/README.md Installs all necessary Node.js dependencies for the APS Tutorials Website project using npm. ```Shell $ npm install ``` -------------------------------- ### Configure .NET Web Host in Program.cs Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vs2022/setup/server.mdx This C# code defines the entry point for a .NET web application, configuring the web host to use the `Startup` class for application setup. It ensures the application creates and runs a web server, essential for hosting the application. ```csharp using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } ``` -------------------------------- ### Initialize Node.js Project for APS Tutorials Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/nodejs-vscode/setup/project.mdx This snippet demonstrates how to create a new project directory, navigate into it, and initialize a Node.js project using 'npm init -y', which creates a 'package.json' file with default settings. ```bash mkdir designAutomationSample cd designAutomationSample npm init -y ``` -------------------------------- ### Update launchSettings.json for Application URL Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vscode/setup/server.mdx This JSON configuration updates the `launchSettings.json` file, located under the `Properties` folder, to set the default application URL for the server app to `http://localhost:8080`. This ensures consistency with the tutorial's specified protocol and port. ```json { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:38524", "sslPort": 44323 } }, "profiles": { "MyApsApp": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:8080", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } ``` -------------------------------- ### Install TypeScript Definitions for Autodesk Viewer API Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/04-viewer.mdx This command installs the TypeScript definition file for the Autodesk Viewer API, enabling developers using Node.js to leverage TypeScript for better type checking and autocompletion. ```bash npm install --dev @types/forge-viewer ``` -------------------------------- ### Install Node.js Dependencies for APS Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/nodejs-vscode/setup/project.mdx This command installs the necessary Node.js packages: Express.js for the web application framework, 'express-formidable' for handling 'multipart/form-data' requests, and the official APS SDK ('forge-apis'). ```bash npm install --save express express-formidable forge-apis ``` -------------------------------- ### Get Local Design Automation App Bundles (C#) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/dotnet-vs2022/setup/upload-bundle.mdx This C# method, `GetLocalBundles`, is an HTTP GET endpoint that scans the local 'bundles' folder for .ZIP files and returns their names without extensions. It provides a list of locally available AppBundles for Design Automation. ```C# /// /// Names of app bundles on this project /// [HttpGet] [Route("api/appbundles")] public string[] GetLocalBundles() { // this folder is placed under the public folder, which may expose the bundles // but it was defined this way so it be published on most hosts easily return Directory.GetFiles(LocalBundlesFolder, "*.zip").Select(Path.GetFileNameWithoutExtension).ToArray(); } ``` -------------------------------- ### Initialize Express Server for Static Assets (Node.js) Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/01-simple-viewer/_shared/nodejs-vscode/setup/server.mdx This JavaScript code sets up a basic Express.js server. It serves static files from the 'wwwroot' directory and listens on a port defined in 'config.js'. The server logs its listening port to the console upon startup. ```javascript const express = require('express'); const { PORT } = require('./config.js'); let app = express(); app.use(express.static('wwwroot')); app.listen(PORT, function () { console.log(`Server listening on port ${PORT}...`); }); ``` -------------------------------- ### Update launchSettings.json for Local Development Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/05-acc-admin/_shared/dotnet-vs2022/setup/server.mdx This JSON configuration updates the `launchSettings.json` file to set the default application URL for the 'MyApsApp' profile to `http://localhost:8080`. This ensures the server app uses the specified protocol and port for local development throughout the tutorial. ```json { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:38524", "sslPort": 44323 } }, "profiles": { "MyApsApp": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:8080", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } ``` -------------------------------- ### Update launchSettings.json for Local Server Configuration Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/06-acc-issues/_shared/dotnet-vscode/setup/server.mdx This JSON snippet modifies the `launchSettings.json` file to configure the local development server. It specifically updates the `applicationUrl` property for the `my_aps_app` profile to `http://localhost:8080`, ensuring the application uses the specified protocol and port during development. ```json { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:38524", "sslPort": 44323 } }, "profiles": { "my_aps_app": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:8080", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } ``` -------------------------------- ### Install Node.js Packages for APS Project Source: https://github.com/autodesk-platform-services/aps-tutorials-website/blob/develop/docs/03-tutorials/04-design-automation/_shared/nodejs-vscode/setup/config.mdx This snippet provides a list of `npm install` commands to add essential packages to a Node.js project. These packages include Express for the server, body-parser for JSON handling, multer for file uploads, cookie-session for session management, and various Autodesk Forge/APS APIs for integration. The `--save` flag ensures these dependencies are recorded in `package.json`. ```bash npm install express --save npm install express-formidable --save npm install multer --save npm install cookie-session --save npm install forge-apis --save npm install autodesk.forge.designautomation --save npm install body-parser --save npm install form-data --save npm install socket.io --save ```