Skip to content

Commit d561465

Browse files
committed
change config to power shell with net 6
1 parent 8917b6f commit d561465

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

CADPythonShell/CADPythonShell.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>net48</TargetFramework>
4+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
5+
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
46
<LangVersion>latest</LangVersion>
57
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
68
<UseWindowsForms>true</UseWindowsForms>
79
<UseWPF>true</UseWPF>
810
<Configurations>Debug A22</Configurations>
911
<Configurations>$(Configurations);Release A22</Configurations>
1012
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
11-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1213
</PropertyGroup>
1314
<PropertyGroup>
1415
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
@@ -126,6 +127,9 @@
126127
<None Update="PackageContents.xml">
127128
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
128129
</None>
130+
<None Update="postbuild.ps1">
131+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
132+
</None>
129133
<Resource Include="Images\Copy.png" />
130134
<Resource Include="Images\Cut.png" />
131135
<Resource Include="Images\Delete.png" />
@@ -179,11 +183,7 @@
179183
<PlatformTarget>x64</PlatformTarget>
180184
<ImplicitUsings>enable</ImplicitUsings>
181185
</PropertyGroup>
182-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
183-
<PostBuildEvent>start gpedit</PostBuildEvent>
186+
<PropertyGroup>
187+
<PostBuildEvent>powershell -NoProfile -ExecutionPolicy Unrestricted ./postbuild.ps1 -Configuration '$(Configuration)' -SolutionDir '$(SolutionDir)' -ProjectDir '$(ProjectDir)'</PostBuildEvent>
184188
</PropertyGroup>
185-
186-
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="$(Configuration.Contains('Debug'))">
187-
<Exec Command="set bundle=&quot;C:\ProgramData\Autodesk\ApplicationPlugins\CADPythonShell.bundle\&quot;&#xD;&#xA;if not exist &quot;%25bundle%25&quot; mkdir &quot;%25bundle%25&quot;&#xD;&#xA;xcopy &quot;$(TargetDir)*.*&quot; &quot;%25bundle%25&quot; /Y /I /E /R /EXCLUDE:$(ProjectDir)exclude.txt&#xD;&#xA;xcopy &quot;$(SolutionDir)PackageContents.xml&quot; &quot;%25bundle%25&quot; /Y /R" />
188-
</Target>
189189
</Project>

CADPythonShell/postbuild.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#Copyright 2022 Chuongmep.com \(^_^)/
2+
param ($Configuration, $ProjectDir, $SolutionDir)
3+
Write-Host "Solution Directory:" $SolutionDir
4+
Write-Host "Project Directory:" $ProjectDir
5+
Write-Host "Configuration Name Current:" $Configuration
6+
$bundle = "C:\ProgramData\Autodesk\ApplicationPlugins\CADPythonShell.bundle\"
7+
$content = "PackageContents.xml"
8+
if($Configuration -match "Debug"){
9+
Write-Host "************Start Create Folder And Check File \(^.^)/"
10+
if(Test-Path $bundle){
11+
Write-Host "Exits Path, So Remove All File Exits"
12+
Remove-Item ($bundle) -Recurse
13+
Write-Host "Removed All File Exist"
14+
}
15+
Write-Host "************ Start Copy New File"
16+
xcopy ($SolutionDir + $content) $bundle /Y
17+
xcopy ($ProjectDir + "*.*") $bundle /Y /I /E /R
18+
Write-Host "************ Oh my got ! Copy Complete! Chuongmep.com \(^_^)/"
19+
}
20+
else
21+
{
22+
Write-Host "Please Toggle To Debug Model If You Want Copy File And Debug \(^_^)/ , config in postbuild.ps1"
23+
}
24+
25+
## Recommended Content
26+
## https://docs.microsoft.com/en-us/visualstudio/ide/how-to-change-the-build-output-directory?view=vs-2022
27+
#if you want try with post build event
28+
#set bundle="C:\ProgramData\Autodesk\ApplicationPlugins\CADPythonShell.bundle\"
29+
#if not exist "%bundle%" mkdir "%bundle%"
30+
#xcopy "$(TargetDir)*.*" "%bundle%" /Y /I /E /R
31+
#xcopy "$(SolutionDir)PackageContents.xml" "%bundle%" /Y /R

0 commit comments

Comments
 (0)