1616using Microsoft . VisualStudio . ProjectSystem ;
1717using Microsoft . VisualStudio . ProjectSystem . Properties ;
1818using System . Collections . ObjectModel ;
19- using Disasmo . Properties ;
2019
2120namespace Disasmo
2221{
@@ -40,8 +39,8 @@ public class MainViewModel : ViewModelBase
4039 // let's use new name for the temp folder each version to avoid possible issues (e.g. changes in the Disasmo.Loader)
4140 private string DisasmoFolder => "Disasmo-v" + DisasmoPackage . Current ? . GetCurrentVersion ( ) ;
4241
43- public SettingsViewModel SettingsVm { get ; } = new SettingsViewModel ( ) ;
44- public IntrinsicsViewModel IntrinsicsVm { get ; } = new IntrinsicsViewModel ( ) ;
42+ public SettingsViewModel SettingsVm { get ; } = new ( ) ;
43+ public IntrinsicsViewModel IntrinsicsVm { get ; } = new ( ) ;
4544
4645 public event Action MainPageRequested ;
4746
@@ -128,7 +127,6 @@ public string FgPngPath
128127 get => _fgPngPath ;
129128 set => Set ( ref _fgPngPath , value ) ;
130129 }
131-
132130
133131 public ICommand RefreshCommand => new RelayCommand ( ( ) => RunOperationAsync ( _currentSymbol ) ) ;
134132
@@ -550,12 +548,7 @@ public async void RunOperationAsync(ISymbol symbol)
550548
551549 // Find Release-x64 configuration:
552550 Project currentProject = dte . GetActiveProject ( ) ;
553- UnconfiguredProject unconfiguredProject = GetUnconfiguredProject ( currentProject ) ;
554-
555- // it will throw "Release config was not found" to the Output if there is no such config in the project
556- ProjectConfiguration releaseConfig = await unconfiguredProject . Services . ProjectConfigurationsService . GetProjectConfigurationAsync ( "Release" ) ;
557- ConfiguredProject configuredProject = await unconfiguredProject . LoadConfiguredProjectAsync ( releaseConfig ) ;
558- IProjectProperties projectProperties = configuredProject . Services . ProjectPropertiesProvider . GetCommonProperties ( ) ;
551+ IProjectProperties projectProperties = await IdeUtils . GetProjectProperties ( GetUnconfiguredProject ( currentProject ) , "Release" ) ;
559552
560553 ThrowIfCanceled ( ) ;
561554
@@ -635,7 +628,8 @@ public async void RunOperationAsync(ISymbol symbol)
635628 }
636629 }
637630
638- DisasmoOutDir = Path . Combine ( await projectProperties . GetEvaluatedPropertyValueAsync ( "OutputPath" ) , DisasmoFolder + ( SettingsVm . UseDotnetPublishForReload ? "_published" : "" ) ) ;
631+ string outputDir = projectProperties == null ? "bin" : await projectProperties . GetEvaluatedPropertyValueAsync ( "OutputPath" ) ;
632+ DisasmoOutDir = Path . Combine ( outputDir , DisasmoFolder + ( SettingsVm . UseDotnetPublishForReload ? "_published" : "" ) ) ;
639633 string currentProjectDirPath = Path . GetDirectoryName ( _currentProjectPath ) ;
640634
641635 dte . SaveAllActiveDocuments ( ) ;
@@ -648,13 +642,15 @@ public async void RunOperationAsync(ISymbol symbol)
648642 return ;
649643 }
650644
645+ string tfmPart = SettingsVm . DontGuessTFM ? "" : $ "-f { _currentTf } ";
646+
651647 ProcessResult publishResult ;
652648 if ( SettingsVm . UseDotnetPublishForReload )
653649 {
654650 LoadingStatus = $ "dotnet publish -r win-x64 -c Release -o ...";
655651
656652 string dotnetPublishArgs =
657- $ "publish -f { _currentTf } -r win-x64 -c Release -o { DisasmoOutDir } --self-contained true /p:PublishTrimmed=false /p:PublishSingleFile=false /p:WarningLevel=0 /p:TreatWarningsAsErrors=false -v:q";
653+ $ "publish { tfmPart } -r win-x64 -c Release -o { DisasmoOutDir } --self-contained true /p:PublishTrimmed=false /p:PublishSingleFile=false /p:WarningLevel=0 /p:TreatWarningsAsErrors=false -v:q";
658654
659655 publishResult = await ProcessUtils . RunProcess ( "dotnet" , dotnetPublishArgs , null , currentProjectDirPath , cancellationToken : UserCt ) ;
660656 }
@@ -669,23 +665,25 @@ public async void RunOperationAsync(ISymbol symbol)
669665
670666 LoadingStatus = "dotnet build -c Release -o ..." ;
671667
672- string dotnetBuildArgs = $ "build -f { _currentTf } -c Release -o { DisasmoOutDir } --no-self-contained " +
668+ string dotnetBuildArgs = $ "build { tfmPart } -c Release -o { DisasmoOutDir } --no-self-contained " +
673669 "/p:RuntimeIdentifier=\" \" " +
674670 "/p:RuntimeIdentifiers=\" \" " +
675671 "/p:WarningLevel=0 " +
676672 "/p:TreatWarningsAsErrors=false " ;
677-
678- if ( SettingsVm . UseNoRestoreFlag )
679- dotnetBuildArgs += " --no-restore --no-dependencies --nologo" ;
680673
681- var fasterBuildArgs = new Dictionary < string , string >
674+ Dictionary < string , string > fasterBuildEnvVars = new Dictionary < string , string >
682675 {
683- [ "DOTNET_TC_QuickJitForLoops" ] = "1" , // slightly speeds up build (not needed for >=.net7.0)
684676 [ "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" ] = "1" ,
685- [ "DOTNET_MULTILEVEL_LOOKUP" ] = "0" ,
686677 [ "DOTNET_CLI_TELEMETRY_OPTOUT" ] = "1"
687678 } ;
688- publishResult = await ProcessUtils . RunProcess ( "dotnet" , dotnetBuildArgs , fasterBuildArgs ,
679+
680+ if ( SettingsVm . UseNoRestoreFlag )
681+ {
682+ dotnetBuildArgs += " --no-restore --no-dependencies --nologo" ;
683+ fasterBuildEnvVars [ "DOTNET_MULTILEVEL_LOOKUP" ] = "0" ;
684+ }
685+
686+ publishResult = await ProcessUtils . RunProcess ( "dotnet" , dotnetBuildArgs , fasterBuildEnvVars ,
689687 currentProjectDirPath ,
690688 cancellationToken : UserCt ) ;
691689 }
0 commit comments