Skip to content

Commit

Permalink
tons of improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
salaros committed Sep 13, 2021
1 parent a493d15 commit 83317b4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 181 deletions.
2 changes: 2 additions & 0 deletions CodeAnalyzers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

<!-- Analyzers-related configuration -->
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<AnalysisLevel>preview</AnalysisLevel>
<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>
<CodeAnalysisRuleSet Condition="Exists('$(SolutionDir)\stylecop.ruleset')">$(SolutionDir)\stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
Expand Down
15 changes: 12 additions & 3 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="true" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="true" />
</packageRestore>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
3 changes: 2 additions & 1 deletion src/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Localization: test string with spaces" xml:space="preserve">
<value>Localization: test string with spaces -&gt;work!</value>
<value>Localization: test string with spaces -&gt;works!</value>
<comment>Demonstrates how original string (Name) is replaced by translated string (Value)</comment>
</data>
</root>
138 changes: 0 additions & 138 deletions src/Properties/Resources.ru-RU.resx

This file was deleted.

14 changes: 13 additions & 1 deletion src/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"profiles": {
"Revit 2022": {
"commandName": "Executable",
"executablePath": "%ProgramW6432%\\Autodesk\\Revit 2022\\Revit.exe",
"commandLineArgs": "",
"use64Bit": true
},
"Revit 2021": {
"commandName": "Executable",
"executablePath": "%ProgramW6432%\\Autodesk\\Revit 2021\\Revit.exe",
"commandLineArgs": "",
"use64Bit": true
},
"Revit 2020": {
"commandName": "Executable",
"executablePath": "%ProgramW6432%\\Autodesk\\Revit 2020\\Revit.exe",
Expand Down Expand Up @@ -43,4 +55,4 @@
"use64Bit": true
}
}
}
}
57 changes: 22 additions & 35 deletions src/RevitAddin.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop" ToolsVersion="Current">

<PropertyGroup>
<LangVersion>preview</LangVersion>

<IsPackable>false</IsPackable>
<ResolveNuGetPackages>true</ResolveNuGetPackages>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>

<Configurations>Debug;Release;Debug One</Configurations>

<!-- Forcibly set platform to 'x64' and ignore architecture-related problems -->
Expand All @@ -11,6 +17,7 @@
<PropertyGroup>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -42,35 +49,30 @@
<TargetFrameworks>net48</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' And '$(RevitVersion)' == ''">
<RevitVersion>2014</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' And '$(RevitVersion)' == ''">
<RevitVersion>2015</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' And '$(RevitVersion)' == ''">
<RevitVersion>2016</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' And '$(RevitVersion)' == ''">
<RevitVersion>2017</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' And '$(RevitVersion)' == ''">
<RevitVersion>2018</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net47' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net47' And '$(RevitVersion)' == ''">
<RevitVersion>2019</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net471' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net471' And '$(RevitVersion)' == ''">
<RevitVersion>2020</RevitVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' And '$(RevitVersion)' == ''">
<RevitVersion>2021</RevitVersion>
</PropertyGroup>
<!--
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
<RevitVersion>2022</RevitVersion>
</PropertyGroup>
-->

<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
Expand Down Expand Up @@ -113,16 +115,6 @@
<PackageReference Include="Autodesk.Revit.SDK" Version="2022.*" Condition=" '$(RevitVersion)' == '2022' " PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(UseWPF)' == 'true'">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup Condition="'$(UseWindowsForms)' == 'true'">
<Reference Include="System.Windows.Forms" />
</ItemGroup>

<ItemGroup>
<!-- Add-in manifest is processed via MSBuild -->
<Content Include="AddinManifest.addin">
Expand Down Expand Up @@ -213,18 +205,8 @@
<AddinFileBak>$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\%(AddinFiles.FileName)%(AddinFiles.Extension).bak</AddinFileBak>
<AddinFileDisabled>$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\%(AddinFiles.FileName)%(AddinFiles.Extension).disabled</AddinFileDisabled>
</PropertyGroup>
<Message
Condition="!Exists('$(AddinFileBak)') And !Exists('$(AddinFileDisabled)')"
Importance="high"
Text="Copying addin file into Revit Addin folder ($(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\)" />
<Copy
Condition="!Exists('$(AddinFileBak)') And !Exists('$(AddinFileDisabled)')"
SourceFiles="@(AddinFiles)"
DestinationFolder="$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\"
SkipUnchangedFiles="true"
OverwriteReadOnlyFiles="true"
Retries="3"
RetryDelayMilliseconds="300" />
<Message Condition="!Exists('$(AddinFileBak)') And !Exists('$(AddinFileDisabled)')" Importance="high" Text="Copying addin file into Revit Addin folder ($(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\)" />
<Copy Condition="!Exists('$(AddinFileBak)') And !Exists('$(AddinFileDisabled)')" SourceFiles="@(AddinFiles)" DestinationFolder="$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" Retries="3" ContinueOnError="true" RetryDelayMilliseconds="300" />
</Target>

<Target Name="CleanAddinsInAppData" AfterTargets="AfterClean" Condition="'$(RevitVersion)' != ''">
Expand All @@ -236,4 +218,9 @@
<Delete Files="@(AddinFiles)" />
</Target>

<Target Name="Revit2022Build" BeforeTargets="DispatchToInnerBuilds">
<Message Importance="high" Text="Run a parallel MSBuild task just for Revit 2022" />
<MSBuild Projects="$(MSBuildProjectFile)" Properties="Configuration=$(Configuration);TargetFramework=net48;RevitVersion=2022"></MSBuild>
</Target>

</Project>
5 changes: 2 additions & 3 deletions src/RevitAddin.vstemplate
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>Revit 2014-2021 C# Addin</Name>
<Description>Class library template for a Revit 2014-2021 C# .NET add-in project</Description>
<Name>Revit 2014-2022 C# Addin</Name>
<Description>Class library template for a Revit 2014-2022 C# .NET add-in project</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
Expand All @@ -18,7 +18,6 @@
<Folder Name="Properties" TargetFolderName="Properties">
<ProjectItem ReplaceParameters="true" TargetFileName="launchSettings.json">launchSettings.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.resx">Resources.resx</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.ru-RU.resx">Resources.ru-RU.resx</ProjectItem>
</Folder>
<Folder Name=".vs" TargetFolderName=".vs" />
<Folder Name="Resources" TargetFolderName="Resources">
Expand Down

0 comments on commit 83317b4

Please sign in to comment.