简体   繁体   English

.NET 内核 5.0 和应用程序版本控制的组装

[英]Assembly for .NET core 5.0 and application version control

Using Visual studio 2019 Preview and .NET 5.0, Packaging MSIX In the process of releasing an application I noticed that my settings was not carried over between publishes.使用 Visual Studio 2019 预览版和 .NET 5.0,打包 MSIX 在发布应用程序的过程中,我注意到我的设置在发布之间没有保留。 So if you type in an APIkey you would have to retype it if I were to push a update.因此,如果您输入 APIkey,如果我要推送更新,您将不得不重新输入它。 These settings are stored in Settings.cs and works perfectly every time you run the program if a new version is not pushed.这些设置存储在 Settings.cs 中,如果没有推送新版本,则每次运行程序时都能完美运行。

The assembly file is nowhere to be found so i can not find a way to access [assembly: AssemblyFileVersion("1.0.0.0")].程序集文件无处可寻,因此我找不到访问 [程序集:AssemblyFileVersion("1.0.0.0")] 的方法。 Not under properties -> Application (No button there).不在属性 -> 应用程序下(那里没有按钮)。 Not when searching all files for "AssemblyFileVersion" or "1.0.0.0" or "Assembly".不是在搜索“AssemblyFileVersion”或“1.0.0.0”或“Assembly”的所有文件时。

My objective would be to use the following code to update the settings with previous settings (Upgrade being in settings.cs and a bool)我的目标是使用以下代码使用以前的设置更新设置(升级在 settings.cs 和布尔)

private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) {
            if(Upgrade == true)
            {
                Upgrade();
                Upgrade = false;
                Save();
            }
        }

More info: The settings are stored in new folders under AppData/Local/(AppName)/(The new folder made each new publish)/1.0.0.0.更多信息:设置存储在 AppData/Local/(AppName)/(The new folder made each new publish)/1.0.0.0 下的新文件夹中。 Last one being the.exe version number in this case.在这种情况下,最后一个是 .exe 版本号。

When I tried making my own assemblyinfo file it said that the properties were duplicates.当我尝试制作自己的 assemblyinfo 文件时,它说属性是重复的。

My mistake(s) was not creating a project.skd file on signing to get a StrongName.我的错误是在签名时没有创建 project.skd 文件以获得 StrongName。 So you would go under project properties -> Signing - check "Sign the assembly" and add new on the drop down (I did not use Password protection here so feel free to leave a feedback on that if somebody attempts it).所以你会 go 在项目属性下 - >签名 - 选中“签署程序集”并在下拉列表中添加新的(我在这里没有使用密码保护,所以如果有人尝试,请随时留下反馈)。 By again going under properties and package you can set assembly version and file version manually.通过再次进入属性和 package,您可以手动设置程序集版本和文件版本。 I have not found a automatic way to increment that.我还没有找到一种自动增加它的方法。 Use the code above in your settings-file generated by clicking view code under settings in properties -> settings (<>View Code is an option on the top bar).在您的设置文件中使用上面的代码,通过单击属性 -> 设置中的设置下的查看代码(<>查看代码是顶部栏上的一个选项)。

Hopefully this can help someone else!希望这可以帮助别人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM