chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Configuration.Install;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
[RunInstaller(true)]
|
||||
public class ConfigInstaller : Installer
|
||||
{
|
||||
public override void Install(IDictionary stateSaver)
|
||||
{
|
||||
base.Install(stateSaver);
|
||||
|
||||
string appPath = Context.Parameters["targetdir"];
|
||||
string apiBaseUrl = Context.Parameters["apibaseurl"];
|
||||
|
||||
string configPath = Path.Combine(appPath, "報到系統客戶端.exe.config");
|
||||
|
||||
var xml = new XmlDocument();
|
||||
xml.Load(configPath);
|
||||
|
||||
var nsmgr = new XmlNamespaceManager(xml.NameTable);
|
||||
// applicationSettings 沒 namespace,不用加
|
||||
|
||||
var node = xml.SelectSingleNode(
|
||||
"/configuration/applicationSettings/報到系統客戶端.Properties.Settings" +
|
||||
"/setting[@name='ApiBaseUrl']/value"
|
||||
);
|
||||
|
||||
if (node == null)
|
||||
throw new Exception("找不到 ApiBaseUrl");
|
||||
|
||||
node.InnerText = apiBaseUrl;
|
||||
|
||||
xml.Save(configPath);
|
||||
|
||||
//var config = ConfigurationManager.OpenExeConfiguration(exeConfig);
|
||||
|
||||
//// 取得 applicationSettings
|
||||
//var appSettings = config.GetSection("applicationSettings/報到系統客戶端.Properties.Settings") as ClientSettingsSection;
|
||||
//if (appSettings == null)
|
||||
// throw new Exception("找不到 applicationSettings/報到系統客戶端.Properties.Settings 區段");
|
||||
|
||||
//// 尋找設定值
|
||||
//SettingElement target = null;
|
||||
//foreach (SettingElement s in appSettings.Settings)
|
||||
//{
|
||||
// if (s.Name == "ApiBaseUrl")
|
||||
// {
|
||||
// target = s;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
//if (target == null)
|
||||
// throw new Exception("找不到 ApiBaseUrl");
|
||||
|
||||
//// 寫入設定值
|
||||
//target.Value.ValueXml.InnerText = apiBaseUrl;
|
||||
|
||||
//// 存檔
|
||||
//config.Save(ConfigurationSaveMode.Modified);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 組件的一般資訊是由下列的屬性集控制。
|
||||
// 變更這些屬性的值即可修改組件的相關
|
||||
// 資訊。
|
||||
[assembly: AssemblyTitle("報到系統客戶端安裝自訂動作")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("報到系統客戶端安裝自訂動作")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 將 ComVisible 設為 false 可對 COM 元件隱藏
|
||||
// 組件中的類型。若必須從 COM 存取此組件中的類型,
|
||||
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
|
||||
[assembly: Guid("870587f6-4e78-447e-9afe-d9a44de908f5")]
|
||||
|
||||
// 組件的版本資訊由下列四個值所組成:
|
||||
//
|
||||
// 主要版本
|
||||
// 次要版本
|
||||
// 組建編號
|
||||
// 修訂編號
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{870587F6-4E78-447E-9AFE-D9A44DE908F5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>報到系統客戶端安裝自訂動作</RootNamespace>
|
||||
<AssemblyName>報到系統客戶端安裝自訂動作</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConfigInstaller.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user